Viewing 6 reply threads
  • Author
    Posts
    • #7050
      cully
      Participant

      I have an admin page for some settings. At the top of the page, I get this error: Notice: Undefined index: layout in plugins/piklist/includes/class-piklist-workflow.php on line 594. I’m getting the same error on a number of different project, though I’m using basically the same setup as below. Does this mean I’ve left something out, or do you think it’s a bug?

      My admin page setup looks like:

      
      add_filter('piklist_admin_pages', function ($pages) {
          $pages []= [
              'page_title' => 'Filter Settings',
              'menu_title' => 'Filter Settings',
              'capability' => 'manage_options',
              'menu_slug' => 'of_settings',
              'setting' => 'of_settings',
              'menu_icon' => WordPress::assetUrl("assets/images/filters-16x16.png"),
              'page_icon' => WordPress::assetUrl("assets/images/filters-32x32.png"),
              'single_line' => true,
              'default_tab' => 'General',
              'save_text' => 'Save Settings',
          ];
      
          return $pages;
      });
      

      I have a few tabs. The settings file headers look like:

      my_plugin/parts/settings/general.php:

      
      /*
      Title: General
      Tab: General
      Tab Order: 100
      Setting: of_settings
      Order: 20
      */
      

      my_plugin/parts/settings/sort.php:

      
      /*
      Title: Sorting
      Tab: Sorting
      Tab Order: 300
      Setting: of_settings
      Order: 20
      */
      
    • #7065
      jrcreative
      Member

      @cully I’m not seeing the files under /workflows

      I think that might be your missing piece. I know I overlooked them the first time I created workflows. 🙂

      check out the docs: https://piklist.com/learn/doc/building-first-workflow/

    • #7066
      cully
      Participant

      @jrcreative I don’t have a workflow, but I was under the impression you don’t need to explicitly define one for a settings page. Everything works fine without one, I just get that Notice. In production those notices are turned off, so I don’t see them and everything works the way it should.

    • #7075
      Steve
      Keymaster

      @cully– Workflows need to be defined for any page you want to use it…including Settings.

    • #7082
      cully
      Participant

      @Steve Is that the case if I only want tabs? It seems to work great without defining a workflow, except I get that notice. Would a possible solution be to just check if that key isset before using it in class-piklist-workflow.php?

    • #7087
      Steve
      Keymaster

      @cully– We suggest you setup Workflows for settings page. Though they “may” work, because we put in some backwards compatibility code, they will not be the best they can be in the future.

    • #7100
      cully
      Participant

      Adding a workflow got rid of the error. Thanks!

Viewing 6 reply threads
  • The topic ‘Undefined index: layout’ is closed to new replies.