Ejemplo 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')));
     }
 }
Ejemplo 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();
     }
 }
Ejemplo n.º 3
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'));
     }
 }
Ejemplo n.º 4
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');
 }
Ejemplo n.º 5
0
 /**
  * Register a component
  *
  * @param ICE_Component $component
  * @return boolean
  */
 protected final function register(ICE_Component $component)
 {
     // has the component already been registered?
     if (!isset($this->components[$component->property('name')])) {
         // register it
         $this->components[$component->property('name')] = $component;
     }
     return true;
 }