本文整理汇总了PHP中FluidTYPO3\Flux\Form::getExtensionName方法的典型用法代码示例。如果您正苦于以下问题:PHP Form::getExtensionName方法的具体用法?PHP Form::getExtensionName怎么用?PHP Form::getExtensionName使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类FluidTYPO3\Flux\Form
的用法示例。
在下文中一共展示了Form::getExtensionName方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: processFormForTable
/**
* @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: getIconForTemplate
/**
* 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: registerFormForModelObjectClassName
/**
* 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;
}
示例4: renderOption
/**
* @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: renderOption
/**
* @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;
}