set_parent( $parent ); return $this; } /* Operations */ /** * Add content to page * @uses parent::add_content() * @param string $id Module ID * @param string $title Module title * @param mixed $callback Callback method or other data for building module UI * @param string $context (optional) Context to add module to (Default: primary) * @param string $priority (optional) Controls module ordering (Default: default) * @param array $callback_args (optional) Additional data to pass callback (Default: NULL) * @return object Page instance reference */ public function add_content( $id, $title, $callback = null, $context = 'primary', $priority = 'default', $callback_args = null ) { $opts = [ 'id' => $id, 'title' => $title, 'callback' => $callback, 'context' => $context, 'priority' => $priority, 'callback_args' => $callback_args, ]; return parent::add_content( $id, $opts ); } /** * Parse content by parameters * Sets content value */ protected function parse_content() { // Get raw content $raw = $this->get_content( false ); // Group by context $content = array(); foreach ( $raw as $c ) { // Add new context if ( ! isset( $content[ $c->context ] ) ) { $content[ $c->context ] = array(); } // Add item to context $content[ $c->context ][] = $c; } return $content; } /** * Render content blocks * @param string $context (optional) Context to render */ protected function render_content( $context = 'primary' ) { // Get content $content = $this->get_content(); // Check for context if ( ! isset( $content[ $context ] ) ) { return false; } $content = $content[ $context ]; $out = ''; // Render content ?>
screen = $screen; // Callback if ( is_callable( $c->callback ) ) { $callback = $c->callback; add_meta_box( $c->id, $c->title, $c->callback, $c->screen, $c->context, $c->priority, $c->callback_args ); } else { // Let handlers build output $this->util->do_action( 'render_content', $c->callback, $this, $c ); } } // Output meta boxes do_meta_boxes( $screen, $context, null ); ?>
_require( 'form_submit' ); return $this; } /** * Check if form submission is required * @return bool TRUE if form submission required */ private function is_required_form() { return $this->_is_required( 'form_submit' ); } /* Handlers */ /** * Default Page handler * Builds content blocks * @see this->init_menus() Set as callback for custom admin pages * @uses current_user_can() to check if user has access to current page * @uses wp_die() to end execution when user does not have permission to access page */ public function handle() { if ( ! current_user_can( $this->get_capability() ) ) { wp_die( __( 'Access Denied', 'simple-lightbox' ) ); } wp_enqueue_script( 'postbox' ); ?>

get_label( 'header' ) ); ?>

is_required_form() ) { // Build form output $form_id = $this->add_prefix( 'admin_form_' . $this->get_id_raw() ); $nonce = (object) [ 'action' => $this->get_id(), 'name' => $this->get_id() . '_nonce', ]; ?>
action, $nonce->name ); } ?>
render_content( 'primary' ); ?>
render_content( 'secondary' ); ?>

is_required_form() ) { submit_button(); ?>