APF_Demo_Contact_Tab_Report::replyToAddFormElements PHP Метод

replyToAddFormElements() публичный Метод

Triggered when the tab is loaded.
public replyToAddFormElements ( $oFactory )
    public function replyToAddFormElements($oFactory)
    {
        /*
         * ( optional ) Create a form - To create a form in Admin Page Framework, you need two kinds of components: sections and fields.
         * A section groups fields and fields belong to a section. So a section needs to be created prior to fields.
         * Use the addSettingSections() method to create sections and use the addSettingFields() method to create fields.
         */
        // Section
        $oFactory->addSettingSections($this->_sPageSlug, array('section_id' => $this->_sSectionID, 'tab_slug' => $this->_sTabSlug, 'title' => __('Report Issues', 'admin-page-framework-loader'), 'description' => __('If you find a bug, you can report it from here.', 'admin-page-framework-loader')));
        $_oCurrentUser = wp_get_current_user();
        $oFactory->addSettingFields('report', array('field_id' => 'name', 'title' => __('Your Name', 'admin-page-framework-loader'), 'type' => 'text', 'default' => $_oCurrentUser->user_firstname || $_oCurrentUser->user_firstname ? $_oCurrentUser->user_lastname . ' ' . $_oCurrentUser->user_lastname : '', 'attributes' => array('required' => 'required', 'placeholder' => __('Type your name.', 'admin-page-framewrok-demo'))), array('field_id' => 'from', 'title' => __('Your Email Address', 'admin-page-framework-loader'), 'type' => 'text', 'default' => $_oCurrentUser->user_email, 'attributes' => array('required' => 'required', 'placeholder' => __('Type your email that the developer replies backt to.', 'admin-page-framework-loader'))), array('field_id' => 'expected_result', 'title' => __('Expected Behavior', 'admin-page-framework-loader'), 'type' => 'textarea', 'description' => __('Tell how the framework should work.', 'admin-page-framework-loader'), 'attributes' => array('required' => 'required')), array('field_id' => 'actual_result', 'title' => __('Actual Behavior', 'admin-page-framework-loader'), 'type' => 'textarea', 'description' => __('Describe the behavior of the framework.', 'admin-page-framework-loader'), 'attributes' => array('required' => 'required')), array('field_id' => 'attachments', 'title' => __('Screenshots', 'admin-page-framework-loader'), 'type' => 'image', 'repeatable' => true, 'attributes' => array('size' => 40, 'preview' => array('style' => 'max-width: 200px;'))), array('field_id' => 'system_information', 'type' => 'system', 'title' => __('System Information', 'admin-page-framework-loader'), 'data' => array(__('Custom Data', 'admin-page-framework-loader') => __('This is custom data inserted with the data argument.', 'admin-page-framework-loader'), __('Current Time', 'admin-page-framework') => ''), 'attributes' => array('rows' => 10)), array('field_id' => 'saved_options', 'type' => 'system', 'title' => __('Saved Options', 'admin-page-framework-loader'), 'data' => array('WordPress' => '', 'Admin Page Framework' => '', 'Server' => '', 'PHP' => '', 'PHP Error Log' => '', 'MySQL' => '', 'MySQL Error Log' => '', 'Browser' => '') + get_option('APF_Demo', array()), 'attributes' => array('rows' => 10), 'hidden' => true), array('field_id' => 'allow_sending_system_information', 'title' => __('Confirmation', 'admin-page-framework-loader') . ' (' . __('required', 'admin-page-framework-loader') . ')', 'type' => 'checkbox', 'label' => __('I understand that the system information including a PHP version and WordPress version etc. will be sent along with the messages to help developer trouble-shoot the problem.', 'admin-page-framework-loader'), 'attributes' => array('required' => 'required')), array('field_id' => 'send', 'type' => 'submit', 'label_min_width' => 0, 'value' => __('Send', 'adimn-page-framework-demo'), 'attributes' => array('field' => array('style' => 'float:right; clear:none; display: inline;')), 'skip_confirmation' => true, 'email' => array('to' => '[email protected]', 'subject' => 'Reporting Issue', 'message' => array('report'), 'headers' => '', 'attachments' => '', 'name' => '', 'from' => '')), array());
        // validation + page slug + tab slug
        add_action('validation_' . $this->_sPageSlug . '_' . $this->_sTabSlug, array($this, 'replyToValidateForm'), 10, 4);
    }