getExtensionName() 공개 메소드

public getExtensionName ( ) : string
리턴 string
 /**
  * @param string $table
  * @param Form $form
  */
 protected function processFormForTable($table, Form $form)
 {
     $extensionName = $form->getExtensionName();
     $extensionKey = ExtensionNamingUtility::getExtensionKey($extensionName);
     $tableConfiguration = self::$tableTemplate;
     $fields = array();
     $labelFields = $form->getOption(Form::OPTION_TCA_LABELS);
     $enableColumns = array();
     foreach ($form->getFields() as $field) {
         $name = $field->getName();
         // note: extracts the TCEforms sub-array from the configuration, as required in TCA.
         $fields[$name] = array_pop($field->build());
     }
     if (TRUE === $form->getOption(Form::OPTION_TCA_HIDE)) {
         $enableColumns['disabled'] = 'hidden';
     }
     if (TRUE === $form->getOption(Form::OPTION_TCA_START)) {
         $enableColumns['start'] = 'starttime';
     }
     if (TRUE === $form->getOption(Form::OPTION_TCA_END)) {
         $enableColumns['end'] = 'endtime';
     }
     if (TRUE === $form->getOption(Form::OPTION_TCA_FEGROUP)) {
         $enableColumns['fe_group'] = 'fe_group';
     }
     $tableConfiguration['iconfile'] = ExtensionManagementUtility::extRelPath($extensionKey) . $form->getOption(Form::OPTION_ICON);
     $tableConfiguration['enablecolumns'] = $enableColumns;
     $tableConfiguration['title'] = $form->getLabel();
     $tableConfiguration['languageField'] = 'sys_language_uid';
     $showRecordsFieldList = $this->buildShowItemList($form);
     $GLOBALS['TCA'][$table] = array('ctrl' => $tableConfiguration, 'interface' => array('showRecordFieldList' => implode(',', array_keys($fields))), 'columns' => $fields, 'types' => array(0 => array('showitem' => $showRecordsFieldList)));
     if (TRUE === $form->getOption(Form::OPTION_TCA_DELETE)) {
         $GLOBALS['TCA'][$table]['ctrl']['delete'] = 'deleted';
     }
     if (NULL === $labelFields) {
         reset($fields);
         $GLOBALS['TCA'][$table]['ctrl']['label'] = key($fields);
     } else {
         $GLOBALS['TCA'][$table]['ctrl']['label'] = array_shift($labelFields);
         $GLOBALS['TCA'][$table]['ctrl']['label_alt'] = implode(',', $labelFields);
     }
 }
예제 #2
0
 /**
  * Returns the icon for a template
  * - checks and returns if manually set as option or
  * - checks and returns Icon if it exists by convention in
  *   EXT:$extensionKey/Resources/Public/Icons/$controllerName/$templateName.(png|gif)
  *
  * @param Form $form
  * @return string|NULL
  */
 public static function getIconForTemplate(Form $form)
 {
     if (TRUE === $form->hasOption(Form::OPTION_ICON)) {
         return $form->getOption(Form::OPTION_ICON);
     }
     if (TRUE === $form->hasOption(Form::OPTION_TEMPLATEFILE)) {
         $extensionKey = ExtensionNamingUtility::getExtensionKey($form->getExtensionName());
         $fullTemplatePathAndName = $form->getOption(Form::OPTION_TEMPLATEFILE);
         $templatePathParts = explode('/', $fullTemplatePathAndName);
         $templateName = pathinfo(array_pop($templatePathParts), PATHINFO_FILENAME);
         $controllerName = array_pop($templatePathParts);
         $allowedExtensions = implode(',', self::$allowedIconTypes);
         $iconFolder = ExtensionManagementUtility::extPath($extensionKey, 'Resources/Public/Icons/' . $controllerName . '/');
         $iconRelFolder = ExtensionManagementUtility::extRelPath($extensionKey) . 'Resources/Public/Icons/' . $controllerName . '/';
         $iconPathAndName = $iconFolder . $templateName;
         $iconMatchPattern = $iconPathAndName . '.{' . $allowedExtensions . '}';
         $filesInFolder = TRUE === is_dir($iconFolder) ? glob($iconMatchPattern, GLOB_BRACE) : array();
         $iconFile = TRUE === is_array($filesInFolder) && 0 < count($filesInFolder) ? reset($filesInFolder) : NULL;
         $iconRelPathAndFilename = FALSE === is_null($iconFile) ? $iconRelFolder . str_replace($iconFolder, '', $iconFile) : NULL;
         return $iconRelPathAndFilename;
     }
     return NULL;
 }
예제 #3
0
파일: Core.php 프로젝트: fluidtypo3/flux
 /**
  * Registers a Form instance to use when TCA for a model object class/table is requested.
  *
  * @param string $className
  * @param Form $form
  * @return void
  */
 public static function registerFormForModelObjectClassName($className, Form $form = NULL)
 {
     if (NULL !== $form && TRUE === isset($GLOBALS['_EXTKEY']) && NULL === $form->getExtensionName()) {
         $form->setExtensionName(GeneralUtility::underscoredToUpperCamelCase($GLOBALS['_EXTKEY']));
     }
     self::$forms['models'][$className] = $form;
 }
 /**
  * @param Form $form
  * @param array $parameters
  * @return string
  */
 protected function renderOption(Form $form, array $parameters)
 {
     $name = $parameters['itemFormElName'];
     $value = $parameters['itemFormElValue'];
     $fieldTSConfig = $parameters['fieldTSConfig'];
     $keepItems = isset($fieldTSConfig['keepItems']) ? explode(',', $fieldTSConfig['keepItems']) : NULL;
     $removeItems = isset($fieldTSConfig['removeItems']) ? explode(',', $fieldTSConfig['removeItems']) : NULL;
     $default = isset($fieldTSConfig['default']) ? $fieldTSConfig['default'] : NULL;
     $onChange = 'onclick="if (confirm(TBE_EDITOR.labels.onChangeAlert) && TBE_EDITOR.checkSubmit(-1)){ TBE_EDITOR.submitForm() };"';
     $selector = '';
     try {
         $extension = $form->getExtensionName();
         $thumbnail = MiscellaneousUtility::getIconForTemplate($form);
         $template = pathinfo($form->getOption(Form::OPTION_TEMPLATEFILE), PATHINFO_FILENAME);
         $label = $form->getLabel();
         $optionValue = $extension . '->' . lcfirst($template);
         $selected = FALSE;
         if (TRUE === empty($value)) {
             if (FALSE === empty($default)) {
                 $selected = $optionValue == $default ? ' checked="checked"' : NULL;
             }
         } else {
             $selected = $optionValue == $value ? ' checked="checked"' : NULL;
         }
         $option = $this->getField($selected, $thumbnail, $label, $optionValue, $name, $onChange);
         if (FALSE === empty($keepItems)) {
             if (TRUE === in_array($optionValue, $keepItems)) {
                 $selector .= $option . LF;
             }
         } elseif (FALSE === empty($removeItems)) {
             if (FALSE === in_array($optionValue, $removeItems)) {
                 $selector .= $option . LF;
             }
         } else {
             $selector .= $option . LF;
         }
     } catch (\RuntimeException $error) {
         $this->configurationService->debug($error);
     }
     return $selector;
 }
예제 #5
0
 /**
  * @param Form $form
  * @param array $parameters
  * @return string
  */
 protected function renderOption(Form $form, array $parameters)
 {
     $name = $parameters['itemFormElName'];
     $value = $parameters['itemFormElValue'];
     $onChange = 'onclick="if (confirm(TBE_EDITOR.labels.onChangeAlert) 
     && TBE_EDITOR.checkSubmit(-1)){ TBE_EDITOR.submitForm() };"';
     $selector = '';
     try {
         $extension = $form->getExtensionName();
         $thumbnail = MiscellaneousUtility::getIconForTemplate($form);
         $template = pathinfo($form->getOption(Form::OPTION_TEMPLATEFILE), PATHINFO_FILENAME);
         $formLabel = $form->getLabel();
         if (strpos($formLabel, 'LLL:') === 0) {
             $label = LocalizationUtility::translate($formLabel, $extension);
         } else {
             $label = $formLabel;
         }
         $optionValue = $extension . '->' . lcfirst($template);
         $selected = $optionValue == $value ? ' checked="checked"' : '';
         $option = '<label style="padding: 0.5em; border: 1px solid #CCC; display: inline-block; ' . 'vertical-align: bottom; margin: 0 1em 1em 0; cursor: pointer; ' . ($selected ? 'background-color: #DDD;' : '') . '">';
         $option .= '<img src="' . $thumbnail . '" alt="' . $label . '" style="margin: 0.5em 0 0.5em 0; ' . 'max-width: 196px; max-height: 128px;"/><br />';
         $option .= '<input type="radio" value="' . $optionValue . '"' . $selected . ' name="' . $name . '" ' . $onChange . ' /> ' . $label;
         $option .= '</label>';
         $selector .= $option . LF;
     } catch (\RuntimeException $error) {
         $this->configurationService->debug($error);
     }
     return $selector;
 }