/**
  * override to render the main page
  */
 public function renderMainContent()
 {
     $entriesContainer = new EntriesContainer($this->lifeCycle, $this->topLevelEntries);
     return $entriesContainer->export();
 }
 /**
  * override to render the main page
  */
 public function renderMainContent()
 {
     $view = new View($this->lifeCycle, "admin/entry_edit");
     $view->setTemplateVar("task", $this->task->getSlug());
     $view->setTemplateVar("available_templates", $this->renderAvailableTemplates());
     $view->setTemplateVar("available_posts", $this->renderAvailablePosts());
     $title = "";
     $subtitle = "";
     $id = "";
     $aboveEntries = "";
     $belowEntries = "";
     $usingPost = false;
     $postSelectDisplay = "none";
     $contentEditingDisplay = "block";
     $usingPostDisplay = "block";
     $childrenEntries = [];
     $parent = null;
     if (isset($this->entry)) {
         $title = $this->entry->title;
         $subtitle = $this->entry->subtitle;
         $id = "&id=" . $this->entry->id;
         $aboveEntries = $this->entry->top_content;
         $belowEntries = $this->entry->bottom_content;
         $usingPost = $this->entry->using_post;
         $childrenEntries = $this->entry->getChildren();
         if ($this->entry->getParent()) {
             $parent = $this->entry->getParent()->id;
         }
     }
     if (isset($_POST["title"])) {
         $title = $_POST["title"];
     }
     if (isset($_POST["subtitle"])) {
         $subtitle = $_POST["subtitle"];
     }
     if (isset($_POST["above_entries"])) {
         $aboveEntries = $_POST["above_entries"];
     }
     if (isset($_POST["below_entries"])) {
         $belowEntries = $_POST["below_entries"];
     }
     if (isset($_POST["using_post"])) {
         $usingPost = $_POST["using_post"] == "on";
     }
     if ($usingPost) {
         $postSelectDisplay = "block";
         $contentEditingDisplay = "none";
     }
     if (isset($this->entry) && $this->entry->template == "nested") {
         $usingPostDisplay = "none";
         $postSelectDisplay = "none";
         $contentEditingDisplay = "none";
     }
     if (isset($_GET["parent_id"]) && $_GET["parent_id"]) {
         $parent = $_GET["parent_id"];
     }
     $view->setTemplateVar("using_post", $usingPost ? "checked" : "");
     $view->setTemplateVar("post_select_display", $postSelectDisplay);
     $view->setTemplateVar("content_editing_visibility", $contentEditingDisplay);
     $view->setTemplateVar("using_post_visibility", $usingPostDisplay);
     $view->setTemplateVar("title", $title);
     $view->setTemplateVar("subtitle", $subtitle);
     $view->setTemplateVar("id", $id);
     $aboveEditor = new Editor($this->lifeCycle, "above_entries", $aboveEntries, "Above Children Entries");
     $aboveEditor->setHeight(200);
     $view->setTemplateVar("above_entries", $aboveEditor->export());
     $belowEditor = new Editor($this->lifeCycle, "below_entries", $belowEntries, "Below Children Entries");
     $belowEditor->setHeight(200);
     $view->setTemplateVar("below_entries", $belowEditor->export());
     $entriesContainer = new EntriesContainer($this->lifeCycle, $childrenEntries, $this->entry);
     $view->setTemplateVar("entries", $entriesContainer->export());
     $view->setTemplateVar("action", $this->action);
     if ($parent) {
         $view->setTemplateVar("parent", $parent);
     }
     return $view->export();
 }