/** * Generate the toggle command information. * * @param CommandCollectionInterface $commands The already existing commands. * * @param IAttribute $attribute The attribute. * * @param string $commandName The name of the new command. * * @param string $class The name of the CSS class for the command. * * @param string $language The language name. * * @return void * * @SuppressWarnings(PHPMD.Superglobals) * @SuppressWarnings(PHPMD.CamelCaseVariableName) */ protected function generateToggleCommand($commands, $attribute, $commandName, $class, $language) { if (!$commands->hasCommandNamed($commandName)) { $toggle = new TranslatedToggleCommand(); $toggle->setLanguage($language)->setToggleProperty($attribute->getColName())->setName($commandName)->setLabel($GLOBALS['TL_LANG']['MSC']['metamodelattribute_translatedcheckbox']['toggle'][0])->setDescription(sprintf($GLOBALS['TL_LANG']['MSC']['metamodelattribute_translatedcheckbox']['toggle'][1], $attribute->getName(), $language)); $extra = $toggle->getExtra(); $extra['icon'] = 'visible.gif'; $extra['class'] = $class; if ($commands->hasCommandNamed('show')) { $info = $commands->getCommandNamed('show'); } else { $info = null; } $commands->addCommand($toggle, $info); } }
/** * Build parameter filter widgets. * * @param array $arrJumpTo The jumpTo page. * @param FrontendFilterOptions $objFrontendFilterOptions Frontendfilter options. * @param IAttribute $objAttribute MetaModel Attribute. * @param string $strParamName Param name. * @param array $arrOptions Options. * @param array $arrCount Count configuration. * @param array|null $arrParamValue Parameter value. * @param array $arrMyFilterUrl Filter url of the current filter. * * @return array * * @SuppressWarnings(PHPMD.Superglobals) * @SuppressWarnings(PHPMD.CamelCaseVariableName) */ private function buildParameterFilterWidgets($arrJumpTo, FrontendFilterOptions $objFrontendFilterOptions, $objAttribute, $strParamName, $arrOptions, $arrCount, $arrParamValue, $arrMyFilterUrl) { return array($this->getParamName() => $this->prepareFrontendFilterWidget(array('label' => array($this->get('label') ? $this->get('label') : $objAttribute->getName(), 'GET: ' . $strParamName), 'inputType' => 'tags', 'options' => $arrOptions, 'count' => $arrCount, 'showCount' => $objFrontendFilterOptions->isShowCountValues(), 'eval' => array('includeBlankOption' => $this->get('blankoption') && !$objFrontendFilterOptions->isHideClearFilter(), 'blankOptionLabel' => &$GLOBALS['TL_LANG']['metamodels_frontendfilter']['do_not_filter'], 'multiple' => true, 'colname' => $objAttribute->getColname(), 'urlparam' => $strParamName, 'onlyused' => $this->get('onlyused'), 'onlypossible' => $this->get('onlypossible'), 'template' => $this->get('template')), 'urlvalue' => !empty($arrParamValue) ? implode(',', $arrParamValue) : ''), $arrMyFilterUrl, $arrJumpTo, $objFrontendFilterOptions)); }
/** * Prepare the label depending on yes no mode. * * @param IAttribute $objAttribute The metamodel attribute. * * @return array * * @SuppressWarnings(PHPMD.Superglobals) */ private function prepareLabel(IAttribute $objAttribute) { return $this->get('ynmode') == 'radio' || $this->get('ynfield') ? array($this->get('label') ?: $objAttribute->getName(), $this->get('ynmode') == 'yes' ? $GLOBALS['TL_LANG']['MSC']['yes'] : $GLOBALS['TL_LANG']['MSC']['no']) : array($this->get('label') ?: $objAttribute->getName(), $this->get('ynmode') == 'no' ? sprintf($GLOBALS['TL_LANG']['MSC']['extended_no'], $this->get('label') ?: $objAttribute->getName()) : ($this->get('label') ?: $objAttribute->getName())); }
/** * Prepare the widget label. * * @param IAttribute $objAttribute The metamodel attribute. * * @return array * * @SuppressWarnings(PHPMD.Superglobals) * @SuppressWarnings(PHPMD.CamelCaseVariableName) */ protected function prepareWidgetLabel($objAttribute) { $arrLabel = array($this->get('label') ? $this->get('label') : $objAttribute->getName(), 'GET: ' . $this->getParamName()); if ($this->get('fromfield') && $this->get('tofield')) { $arrLabel[0] .= ' ' . $GLOBALS['TL_LANG']['metamodels_frontendfilter']['fromto']; } elseif ($this->get('fromfield') && !$this->get('tofield')) { $arrLabel[0] .= ' ' . $GLOBALS['TL_LANG']['metamodels_frontendfilter']['from']; } else { $arrLabel[0] .= ' ' . $GLOBALS['TL_LANG']['metamodels_frontendfilter']['to']; } return $arrLabel; }