/**
  * Gets the options for the parameters type
  * @param \ride\library\i18n\translator\Translator $translator
  * @return array
  */
 protected function getParametersNoneOptions(Translator $translator)
 {
     return array(ContentProperties::NONE_404 => $translator->translate('label.parameters.none.404'), ContentProperties::NONE_IGNORE => $translator->translate('label.parameters.none.ignore'), ContentProperties::NONE_RENDER => $translator->translate('label.parameters.none.render'));
 }
 /**
  * Processes the properties form to update the editor for this format
  * @param \ride\library\form\FormBuilder $formBuilder Form builder for the
  * text properties
  * @param \ride\library\i18n\translator\Translator $translator Instance of
  * the translator
  * @param string $locale Current locale
  * @return null
  */
 public function processForm(FormBuilder $formBuilder, Translator $translator, $locale)
 {
     $formBuilder->addRow(TextWidget::PROPERTY_BODY, 'text', array('label' => $translator->translate('label.text'), 'attributes' => array('rows' => '12'), 'filters' => array('trim' => array())));
 }
 /**
  * Gets the available locales options
  * @param \ride\library\cms\node\Node $node
  * @param \ride\library\i18n\translator\Translator $translator
  * @param array $locales
  * @return array Array with the publish code as key and the translation as
  * value
  */
 protected function getLocalesOptions(Node $node, Translator $translator, array $locales)
 {
     $options = array();
     $parentNode = $node->getParentNode();
     if ($parentNode) {
         $inheritedValue = $parentNode->get(Node::PROPERTY_LOCALES, Node::LOCALES_ALL, true, true);
         $options[self::OPTION_INHERITED] = $translator->translate('label.inherited') . ' (' . $inheritedValue . ')';
     }
     $options[Node::LOCALES_ALL] = $translator->translate('label.locales.all');
     foreach ($locales as $locale) {
         $options[$locale] = $translator->translate('language.' . $locale);
     }
     return $options;
 }
 /**
  * Gets the options for the type field
  * @param \ride\library\i18n\translator\Translator $translator
  * @return array
  */
 public function getTypeOptions(Translator $translator)
 {
     return array(self::TYPE_SECTOR => $translator->translate('label.sector'), self::TYPE_CITY => $translator->translate('label.city'), self::TYPE_PROVINCE => $translator->translate('label.province'), self::TYPE_REGION => $translator->translate('label.region'), self::TYPE_COUNTRY => $translator->translate('label.country'), self::TYPE_CONTINENT => $translator->translate('label.continent'));
 }
 /**
  * Get a suffix for the security inherit label based on the inherited settings
  * @param \ride\library\cms\node\Node $node
  * @param \ride\library\i18n\translator\Translator $translator
  * @return string if a publish setting is found the suffix will be " (Yes)" or " (No)"
  */
 protected function getSecurityInheritSuffix(Node $node, Translator $translator)
 {
     $security = $node->get(Node::PROPERTY_SECURITY, Node::AUTHENTICATION_STATUS_EVERYBODY, true, true);
     $suffix = ' (';
     switch ($security) {
         case Node::AUTHENTICATION_STATUS_EVERYBODY:
             $suffix .= $translator->translate('label.allow.everybody');
             break;
         case Node::AUTHENTICATION_STATUS_ANONYMOUS:
             $suffix .= $translator->translate('label.allow.anonymous');
             break;
         case Node::AUTHENTICATION_STATUS_AUTHENTICATED:
             $suffix .= $translator->translate('label.allow.authenticated');
             break;
         default:
             $suffix .= $security;
             break;
     }
     $suffix .= ')';
     return strtolower($suffix);
 }
 /**
  * Gets the security options
  * @param \ride\library\i18n\translator\Translator $translator
  * @return array Array with the publish code as key and the translation as
  * value
  */
 protected function getSecurityOptions(Translator $translator)
 {
     $options = array();
     $options[Node::AUTHENTICATION_STATUS_EVERYBODY] = $translator->translate('label.allow.everybody');
     $options[Node::AUTHENTICATION_STATUS_ANONYMOUS] = $translator->translate('label.allow.anonymous');
     $options[Node::AUTHENTICATION_STATUS_AUTHENTICATED] = $translator->translate('label.allow.authenticated');
     return $options;
 }
 /**
  * Gets the time options between a given range
  * @param \ride\library\i18n\translator\Translator $translator
  * @param integer $min
  * @param integer $max
  * @return array
  */
 protected function getTimeOptions(Translator $translator, $min, $max)
 {
     $options = array();
     foreach ($this->times as $time) {
         if ($time >= $min && $time <= $max) {
             $options[$time] = $translator->translate('label.cache.time.' . $time);
         }
     }
     if ($min < 86400 && 86400 < $max) {
         $options['end-of-day'] = $translator->translate('label.cache.time.end.day');
     }
     return $options;
 }
Пример #8
0
 /**
  * Hook to process the form view
  * @param \ride\library\widget\WidgetProperties $widgetProperties Instance
  * of the widget properties
  * @param \ride\library\i18n\translator\Translator $translator Instance of
  * the translator
  * @param \ride\web\cms\text\Text $text Instance of the text
  * @param \ride\library\mvc\view\View $view Instance of the properties view
  * @return null
  */
 public function processFormView(WidgetProperties $widgetProperties, Translator $translator, Text $text, View $view)
 {
     $this->warnAboutUsedText($widgetProperties, $this->orm->getTextModel(), $text, $translator->translate('warning.cms.text.used'));
 }