Пример #1
0
 private function AddTypeField()
 {
     $name = 'Type';
     $value = $this->page->Exists() ? $this->page->GetType() : (string) PageType::Normal();
     $field = new Select($name, $value);
     $types = PageType::AllowedValues();
     $ex404 = FrontendRouter::Page404($this->site);
     foreach ($types as $type) {
         if ($type == (string) PageType::NotFound() && $ex404 && !$ex404->Equals($this->page)) {
             continue;
         }
         $field->AddOption($type, Trans('Core.PageForm.Type.' . ucfirst($type)));
     }
     $this->AddField($field);
 }