示例#1
0
 public function attachComponent(AbsCmp $component, $position = self::CNR_BODY)
 {
     if ($position === self::CNR_BODY && !($component instanceof CmpTabForm || $component instanceof CmpTab)) {
         throw new \InvalidArgumentException('Component must be a tab instance');
     }
     if ($component instanceof CmpTabForm || $component instanceof CmpTab) {
         if (!$this->activeTab) {
             $component->setActive();
             $this->activeTab = $component;
         }
         $storedActive = $this->menuPage->getElementState($component->getTitle());
         if ($storedActive) {
             $this->activeTab->setInactive();
             $component->setActive();
             $this->activeTab = $component;
         } else {
             $component->setInactive();
         }
     }
     return parent::attachComponent($component, $position);
 }
示例#2
0
 /**
  * AbsCmp constructor.
  *
  * @param AbsCnrComponents $container
  * @param string           $containerPosition
  *
  * @since  1.0.0
  * @author Panagiotis Vagenas <*****@*****.**>
  */
 public function __construct(AbsCnrComponents $container, $containerPosition = AbsCnrComponents::CNR_BODY)
 {
     $this->container = $container;
     $this->container->attachComponent($this, $containerPosition);
 }