wpXtreme / wpdk

WordPress Development Kit
http://wpxtreme.github.io/wpdk/
Other
78 stars 19 forks source link

Notice: Undefined index #33

Closed Mte90 closed 8 years ago

Mte90 commented 10 years ago

I get this error in the code my Meta box.

Notice: Undefined index: options in /home/www/youtube.dev/wp-content/plugins/wpxtreme/wpdk/classes/ui/wpdk-ui-controls.php on line 1690
gfazioli commented 10 years ago

@Mte90 You're probably using a control of type "combo select". In this case you have to set the options array key, as shown below:

<?php

$fields = array(
  __( 'Sample') => array(
    array(
      array(
        'type'    => WPDKUIControlType::SELECT,
        'name'    => 'combo_select_name',
        'label'   => __( 'Combo Label' ),
        'options' => array(
            '' =>        __( 'Select ...' ),
            'first'   => __( 'First Item' ),
            'second'   => __( 'Second Item' ),
            'last'   => __( 'Last Item' ),
         );
        'value'   => 'second',
      )
    ),
  ),
);
Mte90 commented 10 years ago

Correct :-) it's possible add an alert for missing parameter for the controls?

gfazioli commented 10 years ago

@Mte90 Yes, for explample in the fields flow use:

<?php
...
empty( $profile_display->page_slug ) ? array(
  array(
    'type'           => WPDKUIControlType::ALERT,
    'alert_type'     => WPDKUIAlertType::WARNING,
    'dismiss_button' => false,
    'class'          => 'arrow-top-left',
    'title'          => __( 'Warning!' ),
    'value'          => __( 'You have to set the page profile slug in order to use the shortcode.' ),
  )
) : '',
...
Mte90 commented 10 years ago

I refer an alert in the framework for the developer XD