APF_Demo_Contact_Tab_Feedback::replyToAddFormElements PHP Метод

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

Triggered when the tab is loaded.
public replyToAddFormElements ( $oFactory ) : void
Результат void
    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' => __('Feedback', 'admin-page-framework-loader'), 'description' => __('Tell the developer how you are using the framework.', 'admin-page-framework-loader')));
        $_oCurrentUser = wp_get_current_user();
        $oFactory->addSettingFields($this->_sSectionID, 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 here.', 'admin-page-framework-loader'))), array('field_id' => 'use_for_commercial_products', 'title' => __('I use the framework for', 'admin-page-framework-loader'), 'type' => 'radio', 'default' => 1, 'label' => array(1 => __('Commercial Products', 'admin-page-framework-loader'), 0 => __('Non-commercial Products', 'admin-page-framework-loader'))), array('field_id' => 'use_for', 'title' => __('I use the framework for', 'admin-page-framework-loader'), 'type' => 'radio', 'default' => 'others', 'label' => array('plugins' => __('Plugins', 'admin-page-framework-loader'), 'themes' => __('Themes', 'admin-page-framework-loader'), 'others' => __('Others', 'admin-page-framework-loader'))), array('field_id' => 'subject', 'title' => __('Subject', 'admin-page-framework-loader'), 'type' => 'text', 'attributes' => array('size' => 40, 'placeholder' => __('Type the title here.', 'admin-page-framework-loader'))), array('field_id' => 'body', 'title' => __('Message', 'admin-page-framework-loader'), 'type' => 'textarea', 'rich' => true, 'attributes' => array('placeholder' => __('Type the message here.', 'admin-page-framework-loader'))), array('field_id' => 'ip', 'type' => 'hidden', 'value' => $_SERVER["REMOTE_ADDR"]), 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' => array($this->_sSectionID, 'subject'), 'message' => array($this->_sSectionID), 'headers' => '', 'attachments' => '', 'is_html' => true, 'from' => array($this->_sSectionID, 'from'), 'name' => array($this->_sSectionID, 'name'))));
    }
APF_Demo_Contact_Tab_Feedback