Modules\Sections\Module::afterInitialization PHP Метод

afterInitialization() публичный Метод

public afterInitialization ( )
    public function afterInitialization()
    {
        parent::afterInitialization();
        $this->adminPanelRouteRegister();
        $this->menuCreator();
        $this->container->dispatcher->addListener('basecontroller.render.before', function ($event) {
            $arItems = $this->findFieldValues($event);
            if (!$arItems) {
                return true;
            }
            $model = ModelsFactory::getModel('sections');
            $arRes = $model->where('active', 1)->get();
            $data = [];
            foreach ($arRes as $item) {
                if (($arItems['parent_id'] || null === $arItems['parent_id']) && $item->id != $event->getParams()['fieldsValues']->id) {
                    $data[$item->id] = $item->name;
                }
            }
            foreach ($arItems as $name => $values) {
                $event->getParams()['ttt'][$name]->values = $values + $data;
            }
        });
    }