Tagged: ,

Viewing 4 reply threads
  • Author
    Posts
    • #6656
      mcmaster
      Member

      I just realized that tabs are no longer working in settings files. Is this a change for 0.9.9.8? Do I need to define workflows in order to use tabs now?

      If so, it might be time to update https://piklist.com/user-guide/docs/settings-admin-page-parameters/ and https://piklist.com/user-guide/docs/file-structure/settings-page-section/.

      If not, then I’ll share my code and see if someone can figure out what I’m doing wrong.

      Thanks,
      Donna

    • #6659
      mcmaster
      Member

      Okay, I tried to create a workflow following https://piklist.com/user-guide/docs/building-workflows-piklist-v0-9-9/ and studying the Piklist demo add-on. Didn’t get much further.

      My test files create one workflow (Test Workflow) with 2 tabs (First & Second). The First tab has two fields; Second has one. See the uploaded result.

      The Settings page definition is lifted from Piklist Demos with minor changes:

      
      add_filter('piklist_admin_pages', 'my_test_admin_pages');
      function my_test_admin_pages($pages)
        {
          $pages[] = array(
            'page_title' => __('My Settings', 'piklist')
            ,'menu_title' => __('My Settings', 'piklist')
            ,'capability' => 'manage_options'
            ,'sub_menu' => 'edit.php?post_type=page'
            ,'menu_slug' => 'my-settings'
            ,'setting' => 'my_settings'
            ,'menu_icon' => plugins_url('piklist/parts/img/piklist-icon.png') 
            ,'page_icon' => plugins_url('piklist/parts/img/piklist-page-icon-32.png')
            ,'default_tab' => 'First'
            ,'single_line' => true
            ,'save_text' => 'Save these settings'
          );
          return $pages;
        }
      

      Workflow header file and two tab files in parts/workflows:

      /*
      Flow: Test Workflow
      Page: my_settings
      Header: true
      Position: edit_form_after_title
      */
      
      /*
      Title: First
      Order: 10
      Flow: Test Workflow
      */
      /*
      Title: Second
      Order: 20
      Flow: Test Workflow
      */

      And then there are three files in parts/settings:

      /*
      Title: First Tab, Field 1
      Order: 10
      Tab: First
      Setting: my_settings
      Flow: Test Workflow
      */
      
        piklist('field', array(
          'type' => 'text'
          ,'field' => 'text11'
          ,'label' => __('Tab 1, Field 1', 'piklist-demo')
          ,'attributes' => array(
            'class' => 'regular-text'
          )
        ));
      
      /*
      Title: First Tab, Field 2
      Order: 20
      Tab: First
      Setting: my_settings
      Flow: Test Workflow
      */
      
        piklist('field', array(
          'type' => 'text'
          ,'field' => 'text12'
          ,'label' => __('Tab 1, Field 2', 'piklist-demo')
          ,'attributes' => array(
            'class' => 'regular-text'
          )
        ));
      
      /*
      Title: Second Tab, Field 1
      Order: 10
      Tab: Second
      Setting: my_settings
      Flow: Test Workflow
      */
      
        piklist('field', array(
          'type' => 'text'
          ,'field' => 'text21'
          ,'label' => __('Tab 2, Field 1', 'piklist-demo')
          ,'attributes' => array(
            'class' => 'regular-text'
          )
        ));
      

      What am I missing here? Thanks for any help!

      Donna

      Attachments:
      You must be logged in to view attached files.
    • #6661
      mcmaster
      Member

      p.s. The instructions for the Page parameter in the Workflows header file were ambiguous in the case of settings, so I tried both “my_settings” (the settings name) and “my-settings” (the settings slug). The attachment to the previous reply was using “my_settings.” This attachment shows the difference when using “my-settings.” As you can see it’s different — the tab 2 fields have disappeared — but I still have no tabs.

      Attachments:
      You must be logged in to view attached files.
    • #6863
      Steve
      Keymaster

      @mcmaster– try using the menu_slug. Let us know if that fixes the issue.

    • #6865
      mcmaster
      Member

      No time today; will test this weekend if not sooner.

Viewing 4 reply threads
  • You must be logged in to reply to this topic.