/** * 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'))); } }
/** * 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(); } }
/** * 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')); } }
/** * 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'); }
/** * 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; }