Tagged: ,

Viewing 5 reply threads
  • Author
    Posts
    • #1912
      Jason
      Keymaster

      Greetings!

      I’m working on a plugin and it has a setting page which contains a repeater group field. I’m struggling to get it to look right. The labels don’t show up, the fields are tight together, and the bottom field is jutted out. On a minor note, subsequent repeated groups don’t have the same width for the first text field. Lastly, you’ll notice the default checkbox value is different; I’m not setting it anywhere. Screenshots

      piklist('field', array(
        'type'    => 'group',
        'field'   => 'taxonomies',
        'label'   => 'Taxonomies',
        'add_more'=> true,
        'fields'  => array(
          array(
            'type'      => 'text',
            'field'     => 'name',
            'label'     => 'Name',
            'required'  => true,
            'columns'   => 12
          ),
          array(
            'type'      => 'checkbox',
            'field'     => 'hierarchical',
            'label'     => 'Hierarchical',
            'required'  => true,
            'columns'   => 12,
            'choices'   => array( 'true' )
          )
        )
      ));
      

      The solution for the labels is to add the columns element with any value. The solution for the jutted field is to set the above field to columns 12.

      I may take a stab at fixing this one myself and submitting a patch, but I wanted to report it and make sure it wasn’t already patched. 🙂

      Thanks!

    • #1913
      Steve
      Keymaster

      @jason– Ok, we have a few things here.

      First I would change your code to the following, which moved the label for your second field to the actual value of the choice:

      piklist('field', array(
        'type'    => 'group',
        'field'   => 'taxonomies',
        'label'   => 'Taxonomies',
        'add_more'=> true,
        'fields'  => array(
          array(
            'type'      => 'text',
            'field'     => 'name',
            'label'     => 'Name',
            'required'  => true,
            'columns'   => 12
          ),
          array(
            'type'      => 'checkbox',
            'field'     => 'hierarchical',
            'required'  => true,
            'columns'   => 12,
            'choices'   => array(
              'true' => 'Hierarchical *'
            )
          )
        )
      ));
      

      Second, we have a new version of Piklist coming out that fixes all the alignment errors.

    • #1918
      Jason
      Keymaster

      Hi Steve!

      Good call on the first, and good to know for the second.

      I’m not sure if I should make a new thread for this, but it pertains to the context. I added another group field, slug, and gave it the field value “slug”. But, above the group is another field that has the same field value. I assumed that because the second slug was inside of a group it would recognize the difference. I believe it stores properly (that is it wouldn’t write to the same row), but apparently it doesn’t distinguish upon retrieval.

      Keep rockin, Piklist!

    • #1919
      Jason
      Keymaster

      Another issue I’m having in the same group: After I add a second instance of the group and save the settings, the checkbox field no longer shows up once the page reloads. Only the checkbox field and only for the non-first fields.

    • #1920
      Jason
      Keymaster

      I tried using a radio instead.. no dice. But switching to a Select did the trick.

    • #1921
      Steve
      Keymaster

      @jason– I’m going to email you some code.

Viewing 5 reply threads
  • The topic ‘Groups in Settings’ is closed to new replies.