本文整理汇总了PHP中RWMB_Select_Field::normalize方法的典型用法代码示例。如果您正苦于以下问题:PHP RWMB_Select_Field::normalize方法的具体用法?PHP RWMB_Select_Field::normalize怎么用?PHP RWMB_Select_Field::normalize使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类RWMB_Select_Field
的用法示例。
在下文中一共展示了RWMB_Select_Field::normalize方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: normalize
/**
* Normalize parameters for field
*
* @param array $field
*
* @return array
*/
static function normalize($field)
{
$field = wp_parse_args($field, array('js_options' => array(), 'placeholder' => 'Select an item'));
$field = parent::normalize($field);
$field['js_options'] = wp_parse_args($field['js_options'], array('allowClear' => true, 'width' => 'off', 'placeholder' => $field['placeholder']));
return $field;
}
示例2: normalize
/**
* Normalize parameters for field
*
* @param array $field
*
* @return array
*/
static function normalize($field)
{
$field = parent::normalize($field);
$field = wp_parse_args($field, array('flatten' => true, 'query_args' => array(), 'field_type' => 'select'));
if ('checkbox_tree' === $field['field_type']) {
$field['field_type'] = 'checkbox_list';
$field['flatten'] = false;
}
switch ($field['field_type']) {
case 'checkbox_list':
case 'radio_list':
$field['flatten'] = 'radio_list' === $field['field_type'] ? true : $field['flatten'];
$field['multiple'] = 'radio_list' === $field['field_type'] ? false : true;
$field = RWMB_Input_Field::normalize($field);
break;
case 'select_advanced':
$field = RWMB_Select_Advanced_Field::normalize($field);
$field['flatten'] = true;
break;
case 'select_tree':
$field = RWMB_Select_Field::normalize($field);
$field['multiple'] = true;
break;
case 'select':
default:
$field = RWMB_Select_Field::normalize($field);
break;
}
return $field;
}
示例3: normalize
/**
* Normalize parameters for field
*
* @param array $field
* @return array
*/
public static function normalize($field)
{
$field['multiple'] = true;
$field['size'] = 0;
$field = parent::normalize($field);
return $field;
}