Ejemplo n.º 1
0
 /**
  * A dropdown field should include a blank option if it is not multiselect
  * unless it autocomplete is also enabled
  *
  * @since 2.0
  * @return boolean
  */
 public static function include_blank_option($options, $field)
 {
     if (empty($options) || $field->type != 'data') {
         return false;
     }
     if (!isset($field->field_options['data_type']) || $field->field_options['data_type'] != 'select') {
         return false;
     }
     return !FrmField::is_multiple_select($field) || FrmField::is_option_true($field, 'autocom');
 }
Ejemplo n.º 2
0
 public static function is_multiple_select($field)
 {
     _deprecated_function(__FUNCTION__, '2.0.9', 'FrmField::is_multiple_select');
     return FrmField::is_multiple_select($field);
 }
Ejemplo n.º 3
0
 /**
  * Get the HTML for a dependent Dynamic field when the parent changes
  */
 public static function ajax_data_options()
 {
     //check_ajax_referer( 'frm_ajax', 'nonce' );
     $args = array('trigger_field_id' => FrmAppHelper::get_param('trigger_field_id', '', 'post', 'absint'), 'entry_id' => FrmAppHelper::get_param('entry_id'), 'field_id' => FrmAppHelper::get_param('field_id', '', 'post', 'absint'), 'container_id' => FrmAppHelper::get_param('container_id', '', 'post', 'sanitize_title'), 'linked_field_id' => FrmAppHelper::get_param('linked_field_id', '', 'post', 'sanitize_title'), 'default_value' => FrmAppHelper::get_param('default_value', '', 'post', 'sanitize_title'), 'prev_val' => FrmAppHelper::get_param('prev_val', '', 'post', 'absint'));
     if ($args['entry_id'] == '') {
         wp_die();
     }
     if (!is_array($args['entry_id'])) {
         $entry_id = explode(',', $args['entry_id']);
     }
     $args['field_data'] = FrmField::getOne($args['field_id']);
     $field = self::initialize_dependent_dynamic_field($args);
     if (is_numeric($args['linked_field_id'])) {
         // If Dynamic field is pulling options from a regular field
         self::get_dependent_dynamic_field_options($args, $field);
     } else {
         if ($args['linked_field_id'] == 'taxonomy') {
             // If Dynamic field is pulling options from a taxonomy
             self::get_dependent_category_field_options($args, $field);
         }
     }
     self::get_dependent_dynamic_field_value($args['prev_val'], $field);
     // Set up HTML ID and HTML name
     $html_id = '';
     $field_name = 'item_meta';
     FrmProFieldsHelper::get_html_id_from_container($field_name, $html_id, $field, $args['container_id']);
     if (FrmField::is_multiple_select($args['field_data'])) {
         $field_name .= '[]';
     }
     $auto_width = isset($field['size']) && $field['size'] > 0 ? 'class="auto_width"' : '';
     require FrmAppHelper::plugin_path() . '/pro/classes/views/frmpro-fields/data-options.php';
     wp_die();
 }