public function onPluginDataRegistryGetData()
 {
     $code = Input::get('registry_plugin_code');
     $type = Input::get('registry_data_type');
     $subtype = Input::get('registry_data_subtype');
     $result = null;
     switch ($type) {
         case 'localization':
             $result = LocalizationModel::getPluginRegistryData($code, $subtype);
             break;
         case 'model-classes':
             $result = ModelModel::getPluginRegistryData($code, $subtype);
             break;
         case 'model-forms':
             $result = ModelFormModel::getPluginRegistryData($code, $subtype);
             break;
         case 'model-lists':
             $result = ModelListModel::getPluginRegistryData($code, $subtype);
             break;
         case 'controller-urls':
             $result = ControllerModel::getPluginRegistryData($code, $subtype);
             break;
         case 'model-columns':
             $result = ModelModel::getPluginRegistryDataColumns($code, $subtype);
             break;
         case 'plugin-lists':
             $result = ModelListModel::getPluginRegistryDataAllRecords($code);
             break;
         case 'permissions':
             $result = PermissionsModel::getPluginRegistryData($code);
             break;
         default:
             throw new SystemException('Unknown plugin registry data type requested.');
     }
     return ['registryData' => $result];
 }
Esempio n. 2
0
 protected function initPluginStructure()
 {
     $basePath = $this->getPluginPath();
     $defaultLanguage = LocalizationModel::getDefaultLanguage();
     $structure = [$basePath . '/Plugin.php' => 'plugin.php.tpl', $basePath . '/updates/version.yaml' => 'version.yaml.tpl', $basePath . '/classes', $basePath . '/lang/' . $defaultLanguage . '/lang.php' => 'lang.php.tpl'];
     $variables = ['authorNamespace' => $this->author_namespace, 'pluginNamespace' => $this->namespace, 'pluginNameSanitized' => $this->sanitizePHPString($this->localizedName), 'pluginDescriptionSanitized' => $this->sanitizePHPString($this->localizedDescription)];
     $generator = new FilesystemGenerator('$', $structure, '$/rainlab/builder/classes/pluginbasemodel/templates');
     $generator->setVariables($variables);
     $generator->generate();
 }
Esempio n. 3
0
 protected function getLanguageList($pluginCode)
 {
     $result = LocalizationModel::listPluginLanguages($pluginCode);
     return $result;
 }
 protected function loadOrCreateBaseModel($language, $options = [])
 {
     $model = new LocalizationModel();
     if (isset($options['pluginCode'])) {
         $model->setPluginCode($options['pluginCode']);
     }
     if (!$language) {
         return $model;
     }
     $model->load($language);
     return $model;
 }