private function _getLabel($optionName)
 {
     if ($this->_reference->getUntranslatedLabel($optionName)) {
         $label = $this->_reference->getUntranslatedLabel($optionName);
         return $this->_translator->trans($label);
     }
     return $optionName;
 }
예제 #2
0
 private function _getLabelMap()
 {
     $toReturn = array();
     $map = $this->_getMetaOptionNamesToAttributeDisplayNames();
     foreach ($map as $metaOptionName => $attributeName) {
         $label = $this->_optionReference->getUntranslatedLabel($metaOptionName);
         $toReturn[$attributeName] = $label;
     }
     return $toReturn;
 }
예제 #3
0
 public function __construct($optionName, $templateName, tubepress_api_options_PersistenceInterface $persistence, tubepress_api_http_RequestParametersInterface $requestParams, tubepress_api_template_TemplatingInterface $templating, tubepress_api_options_ReferenceInterface $optionReference)
 {
     $this->_optionProvider = $optionReference;
     $this->_templateName = $templateName;
     $this->_optionName = $optionName;
     if (!$this->_optionProvider->optionExists($optionName)) {
         throw new InvalidArgumentException(sprintf('Could not find option with name "%s"', $optionName));
     }
     $label = $this->_optionProvider->getUntranslatedLabel($optionName);
     $description = $this->_optionProvider->getUntranslatedDescription($optionName);
     parent::__construct($optionName, $persistence, $requestParams, $templating, $label, $description);
 }
 private function _setLegacyVariables(array &$templateVars)
 {
     $metaNames = $this->_getAllMetaOptionNames();
     $shouldShow = array();
     $labels = array();
     foreach ($metaNames as $metaName) {
         if (!$this->_optionReference->optionExists($metaName)) {
             $shouldShow[$metaName] = false;
             $labels[$metaName] = '';
             continue;
         }
         $shouldShow[$metaName] = $this->_context->get($metaName);
         $untranslatedLabel = $this->_optionReference->getUntranslatedLabel($metaName);
         $labels[$metaName] = $this->_translator->trans($untranslatedLabel);
     }
     $templateVars[tubepress_api_const_template_Variable::META_SHOULD_SHOW] = $shouldShow;
     $templateVars[tubepress_api_const_template_Variable::META_LABELS] = $labels;
 }
예제 #5
0
 /**
  * {@inheritdoc}
  */
 public function getUntranslatedLabelForChoice($choice)
 {
     return $this->_optionsReference->getUntranslatedLabel($choice);
 }
 public function __construct(tubepress_api_options_PersistenceInterface $persistence, tubepress_api_http_RequestParametersInterface $requestParams, tubepress_api_template_TemplatingInterface $templating, tubepress_api_options_ReferenceInterface $optionsReference)
 {
     $optionName = tubepress_api_options_Names::OPTIONS_UI_DISABLED_FIELD_PROVIDERS;
     parent::__construct(self::FIELD_ID, $persistence, $requestParams, $templating, $optionsReference->getUntranslatedLabel($optionName), $optionsReference->getUntranslatedDescription($optionName));
 }