Esempio n. 1
0
 protected function getSettingValue(Setting $setting)
 {
     if ($setting->getType() === Setting::SETTING_TYPE_TEXT) {
         return $setting->getValue();
     }
     if ($setting->getType() === Setting::SETTING_TYPE_BOOLEAN) {
         return $setting->getValue();
     }
     if ($setting->getType() === Setting::SETTING_TYPE_FILE) {
         return $setting->getFile();
     }
     if ($setting->getType() === Setting::SETTING_TYPE_FILES) {
         return $setting->getFiles();
     }
     if ($setting->getType() === Setting::SETTING_TYPE_WYSIWYG) {
         return $setting->getValue();
     }
     if ($setting->getType() === Setting::SETTING_TYPE_DATE) {
         return $setting->getDate();
     }
     if ($setting->getType() === Setting::SETTING_TYPE_DATETIME) {
         return $setting->getDate();
     }
     return null;
 }
Esempio n. 2
0
 /**
  * @param array $options
  * @param Setting $item
  *
  * @return mixed
  */
 public function render($options, $item)
 {
     if ($item->getType() === Setting::SETTING_TYPE_TEXT) {
         return $item->getValue();
     }
     if ($item->getType() === Setting::SETTING_TYPE_BOOLEAN) {
         $booleanWidget = $this->container->get('enhavo_app.table.boolean');
         $options['property'] = 'value';
         return $booleanWidget->render($options, $item);
     }
     if ($item->getType() === Setting::SETTING_TYPE_FILE) {
         $pictureWidget = $this->container->get('enhavo_media.table.picture_widget');
         $options['property'] = 'file';
         return $pictureWidget->render($options, $item);
     }
     if ($item->getType() === Setting::SETTING_TYPE_FILES) {
         $pictureWidget = $this->container->get('enhavo_media.table.picture_widget');
         $options['property'] = 'files';
         return $pictureWidget->render($options, $item);
     }
     if ($item->getType() === Setting::SETTING_TYPE_WYSIWYG) {
         return $item->getValue();
     }
     if ($item->getType() === Setting::SETTING_TYPE_DATE) {
         $date = $item->getDate();
         if ($date instanceof \DateTime) {
             return $date->format('d.m.y');
         }
         return '';
     }
     if ($item->getType() === Setting::SETTING_TYPE_DATETIME) {
         $date = $item->getDate();
         if ($date instanceof \DateTime) {
             return $date->format('d.m.y H:i');
         }
         return '';
     }
     return '';
 }