• Resolved yst14

    (@yst14)


    I have page tabs within a settings page. On one of these tab pages I have section tabs. On this page I get the following error. I’m not sure what is wrong with my code to cause this issue?

    Notice: Undefined index: tab_slug in […]/admin/apf/factory/admin_page/AdminPageFramework.php on line 339

    Plugin Page:

    // -- Function Name : setUp
    		// -- Params : 
    		// -- Purpose : Sets up the page and tabs
    		function setUp(){
    			$this->setRootMenuPageBySlug('edit.php?post_type=dat_cpt');
    			$this->addSubMenuItem(array('title' => 'Settings','page_slug' => 'dat_settings'));
    			$this->setPageHeadingTabsVisibility(false);
    			// disables the page heading tabs by passing false.
    			$this->setInPageTabTag('h2');
    			// sets the tag used for in-page tabs
    			// Add form sections
    			$this->addInPageTabs('dat_settings', // set the target page slug so that the 'page_slug' key can be omitted from the next continuing in-page tab arrays.
    			array('tab_slug' => 'dat_email_settings', // avoid hyphen(dash), dots, and white spaces
    				'title' => __('Email Notification Settings', 'dat-email-notification-settings') ,),
    
    			array('tab_slug' => 'dat_custom_template', // avoid hyphen(dash), dots, and white spaces
    				'title' => __('Custom Template', 'dat-custom-template') ,),
    
    			array('tab_slug' => 'dat_form_settings', // avoid hyphen(dash), dots, and white spaces
    				'title' => __('Form Settings', 'dat-form-settings') ,),
    
    			array('tab_slug' => 'dat_support',
    				'title' => __('Support', 'dat-support'),));
    			
    		}

    Plugin Page Tab Content:

    // -- Function Name : load_dat_settings_dat_form_settings
    		// -- Params : $oAdminPage
    		// -- Purpose : Loads all fields for the form settings page
    		function load_dat_settings_dat_form_settings($oAdminPage){
    
    			$this->addSettingSections(
       				array(
        				'section_id'        => 'dat_form_settings_name_section',
        				'section_tab_slug'  => 'form_settings_tabbed',
        				'title'             => 'Name Field',
        				
    				),
    				array(
        				'section_id'        => 'dat_form_settings_job_title_section',
        				'section_tab_slug'  => 'form_settings_tabbed',
        				'title'             => 'Job Title Field',
    				),
    				array(
        				'section_id'        => 'dat_form_settings_company_name_section',
        				'section_tab_slug'  => 'form_settings_tabbed',
        				'title'             => 'Company Name Field',
    				),
    				array(
        				'section_id'        => 'dat_form_settings_photo_section',
        				'section_tab_slug'  => 'form_settings_tabbed',
        				'title'             => 'Photo Field',
    				),
    				array(
        				'section_id'        => 'dat_form_settings_testimonial_section',
        				'section_tab_slug'  => 'form_settings_tabbed',
        				'title'             => 'Testimonial Field',
    				)
    			);
    
    			$this->addSettingFields(
        'dat_form_settings_name_section', // the target section ID
        array(
        'field_id'      => 'dat_form_settings_name_enabled',
        'title'         => __( 'Hide Field', 'admin-page-framework-loader' ),
        'type'          => 'checkbox',
        'description' => 'This will hide the "Name" field of the testimonial form. Note this is the "post title" so all testimonials will be untitled',
        'default'   => false,
    ),
        array(
        'field_id'      => 'dat_form_settings_name_required',
        'title'         => __( 'Not a Required Field', 'admin-page-framework-loader' ),
        'type'          => 'checkbox',
        'description' => 'This will make the "Name" field no longer required.',
        'default'   => false,
    ),
        array(
       'field_id'          => 'dat_form_settings_name_label',
        'title'             => __( 'Label', 'admin-page-framework-loader' ),
        'type'              => 'text',
        'default'           => 'Name',
    ),
        'dat_form_settings_job_title_section', // the target section ID
        array(
        'field_id'      => 'dat_form_settings_job_title_enabled',
        'title'         => __( 'Hide Field', 'admin-page-framework-loader' ),
        'type'          => 'checkbox',
        'description' => 'This will hide the "Name" field of the testimonial form. Note this is the "post title" so all testimonials will be untitled',
        'default'   => false,
    ),
        array(
        'field_id'      => 'dat_form_settings_job_title_required',
        'title'         => __( 'Not a Required Field', 'admin-page-framework-loader' ),
        'type'          => 'checkbox',
        'description' => 'This will make the "Name" field no longer required.',
        'default'   => false,
    ),
        array(
       'field_id'          => 'dat_form_settings_job_title_label',
        'title'             => __( 'Label', 'admin-page-framework-loader' ),
        'type'              => 'text',
        'default'           => 'Job Title',
    ),
        'dat_form_settings_company_name_section', // the target section ID
        array(
        'field_id'      => 'dat_form_settings_company_name_enabled',
        'title'         => __( 'Hide Field', 'admin-page-framework-loader' ),
        'type'          => 'checkbox',
        'description' => 'This will hide the "Name" field of the testimonial form. Note this is the "post title" so all testimonials will be untitled',
        'default'   => false,
    ),
        array(
        'field_id'      => 'dat_form_settings_company_name_required',
        'title'         => __( 'Not a Required Field', 'admin-page-framework-loader' ),
        'type'          => 'checkbox',
        'description' => 'This will make the "Name" field no longer required.',
        'default'   => false,
    ),
        array(
       'field_id'          => 'dat_form_settings_company_name_label',
        'title'             => __( 'Label', 'admin-page-framework-loader' ),
        'type'              => 'text',
        'default'           => 'Company Name',
    ),
         'dat_form_settings_photo_section', // the target section ID
        array(
        'field_id'      => 'dat_form_settings_photo_enabled',
        'title'         => __( 'Hide Field', 'admin-page-framework-loader' ),
        'type'          => 'checkbox',
        'description' => 'This will hide the "Name" field of the testimonial form. Note this is the "post title" so all testimonials will be untitled',
        'default'   => false,
    ),
        array(
        'field_id'      => 'dat_form_settings_photo_required',
        'title'         => __( 'Not a Required Field', 'admin-page-framework-loader' ),
        'type'          => 'checkbox',
        'description' => 'This will make the "Name" field no longer required.',
        'default'   => false,
    ),
        array(
       'field_id'          => 'dat_form_settings_photo_label',
        'title'             => __( 'Label', 'admin-page-framework-loader' ),
        'type'              => 'text',
        'default'           => 'Photo',
    ),
        'dat_form_settings_testimonial_section', // the target section ID
        array(
        'field_id'      => 'dat_form_settings_testimonial_enabled',
        'title'         => __( 'Hide Field', 'admin-page-framework-loader' ),
        'type'          => 'checkbox',
        'description' => 'This will hide the "Name" field of the testimonial form. Note this is the "post title" so all testimonials will be untitled',
        'default'   => false,
    ),
        array(
        'field_id'      => 'dat_form_settings_testimonial_required',
        'title'         => __( 'Not a Required Field', 'admin-page-framework-loader' ),
        'type'          => 'checkbox',
        'description' => 'This will make the "Name" field no longer required.',
        'default'   => false,
    ),
        array(
       'field_id'          => 'dat_form_settings_testimonial_label',
        'title'             => __( 'Label', 'admin-page-framework-loader' ),
        'type'              => 'text',
        'default'           => 'Photo',
    ),
         array(
       'field_id'          => 'dat_form_settings_testimonial_limit',
        'title'             => __( 'Character Limit', 'admin-page-framework-loader' ),
        'type'              => 'text',
        'default'           => '',
    )
    );
    
    		}
Viewing 2 replies - 1 through 2 (of 2 total)
  • Plugin Author miunosoft

    (@miunosoft)

    Hello,

    Try setting the tab_slug argument in the section definition argument arrays.

    
        public function load_dat_settings_dat_form_settings( $oAdminPage ) {
    
            $this->addSettingSections(
                array(
                    'tab_slug'         => 'dat_form_settings', // <--- this
                    'section_id'       => 'dat_form_settings_name_section',
                    'section_tab_slug' => 'form_settings_tabbed',
                    'title'            => 'Name Field',
                ),
                array(
                    'tab_slug'         => 'dat_form_settings', // <--- this
                    'section_id'       => 'dat_form_settings_job_title_section',
                    'section_tab_slug' => 'form_settings_tabbed',
                    'title'            => 'Job Title Field',
                ),
                array(
                    'tab_slug'         => 'dat_form_settings', // <--- this
                    'section_id'       => 'dat_form_settings_company_name_section',
                    'section_tab_slug' => 'form_settings_tabbed',
                    'title'            => 'Company Name Field',
                ),
                array(
                    'tab_slug'         => 'dat_form_settings', // <--- this
                    'section_id'       => 'dat_form_settings_photo_section',
                    'section_tab_slug' => 'form_settings_tabbed',
                    'title'            => 'Photo Field',
                ),
                array( 
                    'tab_slug'         => 'form_settings', // <--- this
                    'section_id'       => 'dat_form_settings_testimonial_section',
                    'section_tab_slug' => 'form_settings_tabbed',
                    'title'            => 'Testimonial Field',
                )
            );
    
    Thread Starter yst14

    (@yst14)

    That worked perfectly, thank you! I must have missed that in the documentation.

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Tabs within Page tabs’ is closed to new replies.