Admin Page Framework Documentation
  • Package
  • Class
  • Tree

Packages

  • AdminPageFramework
    • FieldType
    • MetaBox
    • NetworkAdmin
      • Page
    • Page
    • PageMetaBox
    • PostType
    • TaxonomyField
  • None

Classes

  • AdminPageFramework_MetaBox_Page
  • AdminPageFramework_MetaBox_Page_Controller
  • AdminPageFramework_MetaBox_Page_Model
  • AdminPageFramework_MetaBox_Page_Router
  • AdminPageFramework_MetaBox_Page_View
  1 <?php
  2 /**
  3  * Admin Page Framework
  4  * 
  5  * http://en.michaeluno.jp/admin-page-framework/
  6  * Copyright (c) 2013-2014 Michael Uno; Licensed MIT
  7  * 
  8  */
  9 if ( ! class_exists( 'AdminPageFramework_MetaBox_Page' ) ) :
 10 /**
 11  * Provides methods for creating meta boxes in pages added by the framework.
 12  *
 13  * <h2>Hooks</h2>
 14  * <p>The class automatically creates WordPress action and filter hooks associated with the class methods.
 15  * The class methods corresponding to the name of the below actions and filters can be extended to modify the page output. Those methods are the callbacks of the filters and actions.</p>
 16  * <h3>Methods and Action Hooks</h3>
 17  * <ul>
 18  *     <li><strong>start_{instantiated class name}</strong> – triggered at the end of the class constructor. This receives the class object in the first parameter.</li>
 19  *     <li><strong>set_up{instantiated class name}</strong> – triggered afther the setUp() method is called. This receives the class object in the first parameter.</li>
 20  *     <li><strong>do_{instantiated class name}</strong> – triggered when the meta box gets rendered. The first parameter: the class object [3.1.3+].</li>
 21  * </ul>
 22  * <h3>Methods and Filter Hooks</h3>
 23  * <ul>
 24  *     <li><strong>field_types_{instantiated class name}</strong> – receives the field type definition array. The first parameter: the field type definition array.</li>
 25  *     <li><strong>field_{instantiated class name}_{field ID}</strong> – receives the form input field output of the given input field ID. The first parameter: output string. The second parameter: the array of option.</li>
 26  *     <li><strong>content_{instantiated class name}</strong> – receives the entire output of the meta box. The first parameter: the output HTML string.</li>
 27  *     <li><strong>style_common_{instantiated class name}</strong> –  receives the output of the base CSS rules applied to the pages of the associated post types with the meta box.</li>
 28  *     <li><strong>style_ie_common_{instantiated class name}</strong> –  receives the output of the base CSS rules for Internet Explorer applied to the pages of the associated post types with the meta box.</li>
 29  *     <li><strong>style_{instantiated class name}</strong> –  receives the output of the CSS rules applied to the pages of the associated post types with the meta box.</li>
 30  *     <li><strong>style_ie_{instantiated class name}</strong> –  receives the output of the CSS rules for Internet Explorer applied to the pages of the associated post types with the meta box.</li>
 31  *     <li><strong>script_common_{instantiated class name}</strong> – receives the output of the base JavaScript scripts applied to the pages of the associated post types with the meta box.</li>
 32  *     <li><strong>script_{instantiated class name}</strong> – receives the output of the JavaScript scripts applied to the pages of the associated post types with the meta box.</li>
 33  *     <li><strong>validation_{instantiated class name}</strong> – receives the form submission values as array. The first parameter: submitted input array. The second parameter: the original array stored in the database.</li>
 34  * </ul>
 35  * 
 36  * @abstract
 37  * @since 3.0.0
 38  * @use AdminPageFramework_Utility
 39  * @use AdminPageFramework_Message
 40  * @use AdminPageFramework_Debug
 41  * @use AdminPageFramework_Property_Page
 42  * @package AdminPageFramework
 43  * @subpackage PageMetaBox
 44  */
 45 abstract class AdminPageFramework_MetaBox_Page extends AdminPageFramework_MetaBox_Page_Controller {
 46     
 47     /**
 48      * Registers necessary hooks and internal properties.
 49      * 
 50      * <h4>Examples</h4>
 51      * <code>
 52      *     new APF_MetaBox_For_Pages_Normal(
 53      *         'apf_metabox_for_pages_normal', // meta box id
 54      *         __( 'Sample Meta Box For Admin Pages Inserted in Normal Area' ), // title
 55      *         'apf_first_page', // page slugs
 56      *         'normal', // context
 57      *         'default' // priority
 58      *     );
 59      *     include( APFDEMO_DIRNAME . '/example/APF_MetaBox_For_Pages_Advanced.php' );
 60      *     new APF_MetaBox_For_Pages_Advanced(
 61      *         'apf_metabox_for_pages_advanced', // meta box id
 62      *         __( 'Sample Meta Box For Admin Pages Inserted in Advanced Area' ), // title
 63      *         'apf_first_page', // page slugs
 64      *         'advanced', // context
 65      *         'default' // priority
 66      *     );    
 67      *     include( APFDEMO_DIRNAME . '/example/APF_MetaBox_For_Pages_Side.php' );
 68      *     new APF_MetaBox_For_Pages_Side(
 69      *         'apf_metabox_for_pages_side', // meta box id
 70      *         __( 'Sample Meta Box For Admin Pages Inserted in Advanced Area' ), // title
 71      *         array( 'apf_first_page', 'apf_second_page' ), // page slugs - setting multiple slugs is possible
 72      *         'side', // context
 73      *         'default' // priority
 74      *     );     
 75      * </code>
 76      * @since 3.0.0
 77      * 
 78      * @param string $sMetaBoxID The meta box ID to be created.
 79      * @param string $sTitle The meta box title.
 80      * @param array|string $asPageSlugs     the page slug(s) that the meta box belongs to. If the element is an array, it will be considered as a tab array.
 81      * <code>
 82         $asPageSlugs = array(     
 83             'settings' => array(     // if the key is not numeric and the value is an array, it will be considered as a tab array.
 84                 'help',         // enabled in the tab whose slug is 'help' which belongs to the page whose slug is 'settings'
 85                 'about',         // enabled in the tab whose slug is 'about' which belongs to the page whose slug is 'settings'
 86                 'general', // enabled in the tab whose slug is 'general' which belongs to the page whose slug is 'settings'
 87             ),
 88             'manage', // if the numeric key with a string value is given, the condition applies to the page slug of this string value.
 89         );
 90      * </code>
 91      * @param string $sContext The context, either 'normal', 'advanced', or 'side'.
 92      * @param string $sPriority The priority, either 'high', 'core', 'default' or 'low'.
 93      * @param string $sCapability The capability. See <a href="https://codex.wordpress.org/Roles_and_Capabilities" target="_blank">Roles and Capabilities</a>.
 94      */
 95     function __construct( $sMetaBoxID, $sTitle, $asPageSlugs=array(), $sContext='normal', $sPriority='default', $sCapability='manage_options', $sTextDomain='admin-page-framework' ) {     
 96         
 97         if ( empty( $asPageSlugs ) ) { return; }
 98         
 99         if ( ! $this->_isInstantiatable() ) { return; }
100                 
101         parent::__construct( $sMetaBoxID, $sTitle, $asPageSlugs, $sContext, $sPriority, $sCapability, $sTextDomain );
102                     
103     }
104                 
105 }
106 endif;
Admin Page Framework Documentation API documentation generated by ApiGen 2.8.0