Tagged: ,

Viewing 4 reply threads
  • Author
    Posts
    • #4610
      shayneol
      Participant

      Hello,
      I sent an email yesterday with my code for this issue, but I just figured out what really is going wrong. If I have a conditional attached to a group, I receive the below error message. For example, if I want to show the contents of a group when a specific option from a select field is chosen, I receive an error message on the page. If the content to show/hide is not within a group, everything works fine.

      Error: Warning: array_push() expects parameter 1 to be array, string given in …/wp-content/plugins/piklist/includes/class-piklist-form.php on line 2534

      My Code:

        // Post Type
        piklist('field', array(
          'type' => 'select'
          ,'field' => 'post_type'
          ,'label' => 'Post Type'
          ,'value' => 'choose'
      	,'columns' => 12
          ,'choices' => array(
            'choose' => '--CHOOSE POST TYPE--'
            ,'teacher' => 'Teacher Page'
            ,'standards' => 'Standards'
            ,'lesson_long' => 'Creativity Lesson'
            ,'lesson_short' => 'Skill Builder Lesson'
            ,'glossary' => 'Glossary'
          )
        ));
      
        // STANDARDS FIELDS
        piklist('field', array(
          'type' => 'group'
          ,'field' => 'standards'
      	,'template' => 'field'
          ,'add_more' => true
          ,'label' => 'Add Section'
          ,'description' => 'To add more SECTIONS, the "+" button. Click and drag to rearrange the order.'
          ,'conditions' => array(
            array(
              'field' => 'post_type'
              ,'value' => 'standards'
            )
          )
          ,'fields' => array(
            array(
              'type' => 'text'
              ,'field' => 'section_title'
              ,'label' => 'Section Title'
              ,'columns' => 12
              ,'attributes' => array(
                'class' => 'large-text'
              )
            )
      	  
            ,array(
              'type' => 'text'
              ,'field' => 'section_anchor'
              ,'label' => 'Section Anchor ID'
              ,'columns' => 12
              ,'attributes' => array(
                'class' => 'large-text'
              )
            )
            
      	  ,array(
      		'type' => 'editor'
      		,'field' => 'section_content'
      		,'label' => 'Section Content'
      		,'options' => array(
      			'wpautop' => true
      			,'media_buttons' => true
      			,'shortcode_buttons' => true
      			,'tabindex' => ''
      			,'editor_css' => ''
      			,'editor_class' => ''
      			,'teeny' => false
      			,'dfw' => false
      			,'tinymce' => array(
      				'resize' => false
      				,'wp_autoresize_on' => true
      			)
      			,'quicktags' => true
      			,'drag_drop_upload' => true
      		)
            )
      	  
      	  
          )
        ));
      

      Thanks,
      Shayne

    • #4615
      Steve
      Keymaster

      @shayneol– This is fixed in Piklist v0.9.9.4, which we’re trying to release on Monday.

    • #4616
      shayneol
      Participant

      Awesome. Thanks Steve!

    • #4641
      shayneol
      Participant

      V.9.9.4 seems to have resolved this issue. Thanks guys again for your hard work.

    • #4646
      Steve
      Keymaster

      Great. Closing ticket

Viewing 4 reply threads
  • The topic ‘Conditional Attached to Group Giving Error Message (v0.9.9.3)’ is closed to new replies.