/**
  * @inheritdoc
  */
 public function disableContentContainer(ContentContainerActiveRecord $container)
 {
     parent::disableContentContainer($container);
     foreach (ContainerPage::find()->contentContainer($container)->all() as $page) {
         $page->delete();
     }
 }
 public function actionDelete()
 {
     $this->adminOnly();
     $page = ContainerPage::find()->contentContainer($this->contentContainer)->where(['custom_pages_container_page.id' => Yii::$app->request->get('id')])->one();
     if ($page !== null) {
         $page->delete();
     }
     return $this->redirect($this->contentContainer->createUrl('list'));
 }
 public static function onSpaceMenuInit($event)
 {
     $space = $event->sender->space;
     if ($space->isModuleEnabled('custom_pages')) {
         $pages = ContainerPage::find()->contentContainer($space)->all();
         foreach ($pages as $page) {
             $event->sender->addItem(array('label' => \yii\helpers\Html::encode($page->title), 'group' => 'modules', 'target' => $page->in_new_window ? '_blank' : '', 'url' => $space->createUrl('/custom_pages/container/view', ['id' => $page->id]), 'icon' => '<i class="fa ' . \yii\helpers\Html::encode($page->icon) . '"></i>', 'isActive' => Yii::$app->controller->module && Yii::$app->controller->module->id == 'custom_pages' && Yii::$app->controller->id == 'container' && Yii::$app->controller->action->id == 'view' && Yii::$app->request->get('id') == $page->id, 'sortOrder' => $page->sort_order != '' ? $page->sort_order : 1000));
         }
     }
 }