public function build()
 {
     switch ($this->getState()) {
         case 'buildWidget':
             $result = $this->tmpComponent->build();
             break;
         default:
             $result = parent::build();
             break;
     }
     return $result;
 }
Example #2
0
 public function build()
 {
     switch ($this->getState()) {
         case 'showPageToolbar':
             $result = false;
             // вызываем родительский метод построения
             $result = Component::build();
             if ($result instanceof \DOMDocument) {
                 $result->documentElement->appendChild($result->importNode($this->buildJS(), true));
                 $tbs = $this->getToolbar();
                 if (!empty($tbs)) {
                     foreach ($tbs as $toolbar) {
                         $result->documentElement->appendChild($result->importNode($toolbar->build(), true));
                     }
                 }
             }
             break;
         case 'showTransEditor':
             $result = $this->transEditor->build();
             break;
         case 'showUserEditor':
             $result = $this->userEditor->build();
             break;
         case 'showRoleEditor':
             $result = $this->roleEditor->build();
             break;
         case 'showLangEditor':
             $result = $this->langEditor->build();
             break;
         case 'showSiteEditor':
             $result = $this->siteEditor->build();
             break;
         case 'showWidgetEditor':
             $result = $this->widgetEditor->build();
             break;
         default:
             $result = parent::build();
             break;
     }
     return $result;
 }
Example #3
0
 /**
  * @copydoc IBlock::build
  *
  * @throws SystemException
  */
 public function build()
 {
     if ($this->getState() == 'fileLibrary') {
         $result = $this->fileLibrary->build();
     } elseif ($this->getState() == 'imageManager') {
         $result = $this->imageManager->build();
     } elseif ($this->getState() == 'source') {
         $result = $this->source->build();
     } else {
         if (!$this->getBuilder()) {
             throw new SystemException('ERR_DEV_NO_BUILDER:' . $this->getName() . ': ' . $this->getState(), SystemException::ERR_CRITICAL, $this->getName());
         }
         // передаем данные и описание данных построителю
         if ($this->getData() && method_exists($this->getBuilder(), 'setData')) {
             $this->getBuilder()->setData($this->getData());
         }
         if (method_exists($this->getBuilder(), 'setDataDescription')) {
             $this->getBuilder()->setDataDescription($this->getDataDescription());
         }
         // вызываем родительский метод построения
         $result = parent::build();
         if ($this->js) {
             $result->documentElement->appendChild($result->importNode($this->js, true));
         }
         $toolbars = $this->getToolbar();
         if (!empty($toolbars)) {
             foreach ($toolbars as $tb) {
                 if ($toolbar = $tb->build()) {
                     $result->documentElement->appendChild($result->importNode($toolbar, true));
                 }
             }
         }
         if ($this->pager && $this->getType() == self::COMPONENT_TYPE_LIST && ($pagerData = $this->pager->build())) {
             $pager = $result->importNode($pagerData, true);
             $result->documentElement->appendChild($pager);
         }
         //Работа с константами переводов
         if (($methodConfig = $this->getConfig()->getCurrentStateConfig()) && $methodConfig->translations) {
             foreach ($methodConfig->translations->translation as $translation) {
                 $this->addTranslation((string) $translation['const']);
             }
         }
     }
     return $result;
 }