Пример #1
0
 /**
  */
 public function configure()
 {
     // RUN PARENT FIRST!
     parent::configure();
     // attribute defaults
     if ($this->config()->contains('attributes')) {
         $this->attributes = $this->config('attributes');
     }
 }
Пример #2
0
 /**
  */
 public function configure()
 {
     // RUN PARENT FIRST!
     parent::configure();
     // css title class
     if ($this->config()->contains('class_title')) {
         $this->class_title = $this->config('class_title');
     }
     // css content class
     if ($this->config()->contains('class_content')) {
         $this->class_content = $this->config('class_content');
     }
 }
Пример #3
0
 /**
  */
 public function configure()
 {
     // RUN PARENT FIRST!
     parent::configure();
     // url where to find the screen
     // @todo add this to documentation when stable
     if ($this->config()->contains('url')) {
         $this->url = $this->config('url');
     }
     // target of the screen menu link
     // @todo add this to documentation when stable
     if ($this->config()->contains('target')) {
         $this->target = $this->config('target');
     }
 }
Пример #4
0
 /**
  */
 public function configure()
 {
     // RUN PARENT FIRST!
     parent::configure();
     // section
     if ($this->config()->contains('section')) {
         $this->set_section($this->config('section'));
     } else {
         $this->set_section('default');
     }
     // feature
     if ($this->config()->contains('feature')) {
         $this->feature = $this->config('feature');
     }
     // feature option
     if ($this->config()->contains('feature_option')) {
         $this->feature_option = $this->validate_name($this->config('feature_option'));
     }
     // default value
     if ($this->config()->contains('default_value')) {
         $this->default_value = $this->config('default_value');
     }
     // deprecated name
     if ($this->config()->contains('name_deprecated')) {
         $this->name_deprecated = $this->validate_name($this->config('name_deprecated'));
     }
     // css id
     if ($this->config()->contains('field_id')) {
         $this->field_id = $this->config('field_id');
     }
     // css class
     if ($this->config()->contains('field_class')) {
         $this->field_class = $this->config('field_class');
     }
     // style selector
     if ($this->config()->contains('style_selector')) {
         $this->style_selector = $this->config('style_selector');
     }
     // style property
     if ($this->config()->contains('style_property')) {
         $this->style_property = $this->config('style_property');
     }
     // style unit
     if ($this->config()->contains('style_unit')) {
         $this->style_unit = $this->config('style_unit');
     }
     // style section
     if ($this->config()->contains('style_section')) {
         $this->style_section = $this->config('style_section');
     }
     // setup style property object
     $this->refresh_style_property();
     // field options
     // skip loading field options outside of dashboard
     if (!is_admin()) {
         return;
     }
     // @todo this grew too big, move to private method
     if (is_admin() && $this->config()->contains('field_options')) {
         // grab field options
         $fo_config = $this->config('field_options');
         // is configured field options a map?
         if ($fo_config instanceof ICE_Map) {
             // loop through all field options
             foreach ($fo_config as $field_option) {
                 // split each one at the delimeter
                 $field_option = explode(self::FIELD_OPTION_DELIM, $field_option, 2);
                 // add to array
                 $field_options[trim($field_option[0])] = trim($field_option[1]);
             }
         } elseif (strlen($fo_config)) {
             // possibly a function
             $callback = $fo_config;
             // check if the function exists
             if (function_exists($callback)) {
                 // call it
                 $field_options = $callback();
                 // make sure we got an array
                 if (!is_array($field_options)) {
                     throw new Exception(sprintf('The field options callback function "%s" did not return an array', $callback));
                 }
             } else {
                 throw new Exception(sprintf('The field options callback function "%s" does not exist', $callback));
             }
         } else {
             throw new Exception(sprintf('The field options for the "%s" option is not configured correctly', $name));
         }
     } elseif ($this instanceof ICE_Option_Auto_Field) {
         // skip if already populated
         if ($this->field_options == null) {
             // call template method to load options
             $field_options = $this->load_field_options();
         }
     } elseif ($this->__style_property__) {
         // check type
         switch (true) {
             case $this instanceof ICE_Ext_Option_Select:
             case $this instanceof ICE_Ext_Option_Radio:
                 $field_options = $this->__style_property__->get_list_values();
         }
     }
     // make sure we ended up with some options
     if (isset($field_options) && count($field_options) >= 1) {
         // finally set them for the option
         $this->field_options = $field_options;
     }
 }