function content_block() { $container = container(); $content = new FlipTurnOptionMeta(); // Account for no data in the options table if ($content->existOptionMetaByKey(FT_HOME_PAGE_OPTION)) { $content->loadOptionMetaByKey(FT_HOME_PAGE_OPTION); $container->add(htmlspecialchars_decode($content->getOptionMetaValue())); } else { $container->add(FT_HOME_PAGE_OPTION_DEFAULT_CONTENT); } // Allow the Admin to Edit the page content if ($this->user_is_logged_in()) { $container->add(div_font8bold(html_a('home_edit.php', 'Edit'))); } return $container; }
/** * This method is called ONLY after ALL validation has * passed. This is the method that allows you to * do something with the data, say insert/update records * in the DB. */ function form_action() { $content = new FlipTurnOptionMeta(); $content->setOptionMetaKey(FT_HOME_PAGE_OPTION); $content->setOptionMetaValue(htmlspecialchars($this->get_element_value($this->getEditPageLabel()))); $content->saveOptionMeta(); $this->set_action_message(html_div('ft-note-msg', 'Home page content updated.')); return true; }