Esempio n. 1
0
 /**
  * Add component to this section's content
  *
  * @param ICE_Component $component
  */
 public function add_component(ICE_Component $component)
 {
     // does component section match my name?
     if ($component->property('section') == $this->property('name')) {
         // yep, add to components array
         $this->__components__[] = $component;
     } else {
         // not good
         throw new Exception(sprintf('The component "%s" is not assigned to the section "%s"', $component->property('name'), $this->property('name')));
     }
 }
Esempio n. 2
0
 /**
  * Render documentation for this component
  *
  * @param array $doc_dirs Directory paths under which to search for doc page file
  */
 public final function render_documentation($doc_dirs)
 {
     // get doc setting
     $documentation = $this->component->property('documentation');
     // is documentation set?
     if ($documentation) {
         // boolean value?
         if (is_numeric($documentation)) {
             // use auto naming?
             if ((bool) $documentation == true) {
                 // yes, page is component name
                 $page = $this->policy()->get_handle() . '/' . $this->component->property('name');
             } else {
                 // no, documentation disabled
                 return;
             }
         } else {
             // page name was set manually
             $page = $documentation;
         }
         // new easy doc object
         $doc = new ICE_Docs($doc_dirs, $page);
         // publish it!
         $doc->publish();
     }
 }
Esempio n. 3
0
 /**
  * Check if theme supports this feature
  *
  * @return boolean
  */
 public function supported()
 {
     if (!current_theme_supports($this->name)) {
         return false;
     }
     return parent::supported();
 }
Esempio n. 4
0
 /**
  */
 public function configure()
 {
     // RUN PARENT FIRST!
     parent::configure();
     // attribute defaults
     if ($this->config()->contains('attributes')) {
         $this->attributes = $this->config('attributes');
     }
 }
Esempio n. 5
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');
     }
 }
Esempio n. 6
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');
     }
 }
Esempio n. 7
0
 /**
  * Return all registered child components of a component
  *
  * This adheres to parent settings in the component ini file
  *
  * @param ICE_Component $component The component object whose children you want to get
  * @return array
  */
 public function get_children(ICE_Component $component)
 {
     // the components that will be returned
     $components = array();
     // find all registered component where parent is the target component
     foreach ($this->get_all() as $component_i) {
         if ($component->is_parent_of($component_i)) {
             $components[] = $component_i;
         }
     }
     return $components;
 }
Esempio n. 8
0
 /**
  * Render a button target
  *
  * @param ICE_Component $item
  */
 protected function render_button_target(ICE_Component $item)
 {
     // get target
     $target = $item->property('target');
     // was a target set explicitly?
     if ($target) {
         // use that target
         print esc_attr($target);
     } else {
         // generate a tab target from the name
         $this->render_id('tab', $item->property('name'));
     }
 }
Esempio n. 9
0
 /**
  * Render this option AND its required siblings
  *
  * @param boolean $output Whether to output or return result
  * @return string|void
  */
 public function render($output = true)
 {
     // render myself first
     $html = parent::render($output);
     // render options that require this one
     foreach ($this->policy()->registry()->get_siblings($this) as $sibling_option) {
         $html .= $sibling_option->render($output);
     }
     // return result
     return $output ? true : $html;
 }
Esempio n. 10
0
 /**
  * Render main element container classes
  *
  * @param string $addtl,...
  */
 public function render_classes()
 {
     // escape and print
     print esc_attr($this->component->element()->class_list($addtl = func_get_args()));
 }
Esempio n. 11
0
 /**
  * Returns true if component is parent of given component
  *
  * @param ICE_Component $component
  * @return boolean
  */
 public function is_parent_of(ICE_Component $component)
 {
     return $this->name == $component->property('parent');
 }