当前位置: 首页>>代码示例>>PHP>>正文


PHP acf_encode_choices函数代码示例

本文整理汇总了PHP中acf_encode_choices函数的典型用法代码示例。如果您正苦于以下问题:PHP acf_encode_choices函数的具体用法?PHP acf_encode_choices怎么用?PHP acf_encode_choices使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了acf_encode_choices函数的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: render_field_settings

 /**
  * Create settings for Currency field.
  *
  * @since 1.1.3
  *
  * @param array	$field The field settings.
  */
 function render_field_settings($field)
 {
     $field['default_value'] = acf_encode_choices($field['default_value']);
     // default_value
     acf_render_field_setting($field, array('label' => __('Default Value', 'acf'), 'instructions' => __('Choose a default value', 'acf'), 'type' => 'currency', 'name' => 'default_value'));
     // allow_null
     acf_render_field_setting($field, array('label' => __('Allow Null?', 'acf'), 'instructions' => '', 'type' => 'radio', 'name' => 'allow_null', 'choices' => array(1 => __("Yes", 'acf'), 0 => __("No", 'acf')), 'layout' => 'horizontal'));
     // multiple
     acf_render_field_setting($field, array('label' => __('Select multiple values?', 'acf'), 'instructions' => '', 'type' => 'radio', 'name' => 'multiple', 'choices' => array(1 => __("Yes", 'acf'), 0 => __("No", 'acf')), 'layout' => 'horizontal'));
 }
开发者ID:nekojira,项目名称:wp-currencies,代码行数:17,代码来源:acf-v5.php

示例2: render_field_settings

 function render_field_settings($field)
 {
     // encode choices (convert from array)
     $field['choices'] = acf_encode_choices($field['choices']);
     // choices
     acf_render_field_setting($field, array('label' => __('Choices', 'acf'), 'instructions' => __('Enter each choice on a new line.', 'acf') . '<br /><br />' . __('For more control, you may specify both a value and label like this:', 'acf') . '<br /><br />' . __('red : Red', 'acf'), 'type' => 'textarea', 'name' => 'choices'));
     // default_value
     acf_render_field_setting($field, array('label' => __('Default Value', 'acf'), 'instructions' => __('Enter each default value on a new line', 'acf'), 'type' => 'textarea', 'name' => 'default_value'));
     // layout
     acf_render_field_setting($field, array('label' => __('Layout', 'acf'), 'instructions' => '', 'type' => 'radio', 'name' => 'layout', 'layout' => 'horizontal', 'choices' => array('vertical' => __("Vertical", 'acf'), 'horizontal' => __("Horizontal", 'acf'))));
 }
开发者ID:pellio11,项目名称:ns-select-project,代码行数:11,代码来源:checkbox.php

示例3: render_field_settings

 function render_field_settings($field)
 {
     // encode choices (convert from array)
     $field['choices'] = acf_encode_choices($field['choices']);
     // choices
     acf_render_field_setting($field, array('label' => __('Choices', 'acf'), 'instructions' => __('Enter each choice on a new line.', 'acf') . '<br /><br />' . __('For more control, you may specify both a value and label like this:', 'acf') . '<br /><br />' . __('red : Red', 'acf'), 'type' => 'textarea', 'name' => 'choices'));
     // other_choice
     acf_render_field_setting($field, array('label' => __('Other', 'acf'), 'instructions' => '', 'type' => 'true_false', 'name' => 'other_choice', 'message' => __("Add 'other' choice to allow for custom values", 'acf')));
     // save_other_choice
     acf_render_field_setting($field, array('label' => __('Save Other', 'acf'), 'instructions' => '', 'type' => 'true_false', 'name' => 'save_other_choice', 'message' => __("Save 'other' values to the field's choices", 'acf')));
     // default_value
     acf_render_field_setting($field, array('label' => __('Default Value', 'acf'), 'instructions' => __('Appears when creating a new post', 'acf'), 'type' => 'text', 'name' => 'default_value'));
     // layout
     acf_render_field_setting($field, array('label' => __('Layout', 'acf'), 'instructions' => '', 'type' => 'radio', 'name' => 'layout', 'layout' => 'horizontal', 'choices' => array('vertical' => __("Vertical", 'acf'), 'horizontal' => __("Horizontal", 'acf'))));
 }
开发者ID:bmavus,项目名称:wp-theme-blank,代码行数:15,代码来源:radio.php

示例4: render_field_settings

 function render_field_settings($field)
 {
     // encode choices (convert from array)
     $field['choices'] = acf_encode_choices($field['choices']);
     $field['default_value'] = acf_encode_choices($field['default_value']);
     // choices
     acf_render_field_setting($field, array('label' => __('Choices', 'acf'), 'instructions' => __('Enter each choice on a new line.', 'acf') . '<br /><br />' . __('For more control, you may specify both a value and label like this:', 'acf') . '<br /><br />' . __('red : Red', 'acf'), 'type' => 'textarea', 'name' => 'choices'));
     // default_value
     acf_render_field_setting($field, array('label' => __('Default Value', 'acf'), 'instructions' => __('Enter each default value on a new line', 'acf'), 'type' => 'textarea', 'name' => 'default_value'));
     // allow_null
     acf_render_field_setting($field, array('label' => __('Allow Null?', 'acf'), 'instructions' => '', 'type' => 'radio', 'name' => 'allow_null', 'choices' => array(1 => __("Yes", 'acf'), 0 => __("No", 'acf')), 'layout' => 'horizontal'));
     // multiple
     acf_render_field_setting($field, array('label' => __('Select multiple values?', 'acf'), 'instructions' => '', 'type' => 'radio', 'name' => 'multiple', 'choices' => array(1 => __("Yes", 'acf'), 0 => __("No", 'acf')), 'layout' => 'horizontal'));
     // ui
     acf_render_field_setting($field, array('label' => __('Stylised UI', 'acf'), 'instructions' => '', 'type' => 'radio', 'name' => 'ui', 'choices' => array(1 => __("Yes", 'acf'), 0 => __("No", 'acf')), 'layout' => 'horizontal'));
     // ajax
     acf_render_field_setting($field, array('label' => __('Use AJAX to lazy load choices?', 'acf'), 'instructions' => '', 'type' => 'radio', 'name' => 'ajax', 'choices' => array(1 => __("Yes", 'acf'), 0 => __("No", 'acf')), 'layout' => 'horizontal'));
 }
开发者ID:pellio11,项目名称:ns-select-project,代码行数:18,代码来源:select.php

示例5: render_field_settings

 function render_field_settings($field)
 {
     // encode choices (convert from array)
     $field['choices'] = acf_encode_choices($field['choices']);
     $field['default_value'] = acf_encode_choices($field['default_value'], false);
     // choices
     acf_render_field_setting($field, array('label' => __('Choices', 'acf'), 'instructions' => __('Enter each choice on a new line.', 'acf') . '<br /><br />' . __('For more control, you may specify both a value and label like this:', 'acf') . '<br /><br />' . __('red : Red', 'acf'), 'type' => 'textarea', 'name' => 'choices'));
     // other_choice
     acf_render_field_setting($field, array('label' => __('Allow Custom', 'acf'), 'instructions' => '', 'name' => 'allow_custom', 'type' => 'true_false', 'ui' => 1, 'message' => __("Allow 'custom' values to be added", 'acf')));
     // save_other_choice
     acf_render_field_setting($field, array('label' => __('Save Custom', 'acf'), 'instructions' => '', 'name' => 'save_custom', 'type' => 'true_false', 'ui' => 1, 'message' => __("Save 'custom' values to the field's choices", 'acf')));
     // default_value
     acf_render_field_setting($field, array('label' => __('Default Value', 'acf'), 'instructions' => __('Enter each default value on a new line', 'acf'), 'type' => 'textarea', 'name' => 'default_value'));
     // layout
     acf_render_field_setting($field, array('label' => __('Layout', 'acf'), 'instructions' => '', 'type' => 'radio', 'name' => 'layout', 'layout' => 'horizontal', 'choices' => array('vertical' => __("Vertical", 'acf'), 'horizontal' => __("Horizontal", 'acf'))));
     // layout
     acf_render_field_setting($field, array('label' => __('Toggle', 'acf'), 'instructions' => __('Prepend an extra checkbox to toggle all choices', 'acf'), 'name' => 'toggle', 'type' => 'true_false', 'ui' => 1));
     // return_format
     acf_render_field_setting($field, array('label' => __('Return Value', 'acf'), 'instructions' => __('Specify the returned value on front end', 'acf'), 'type' => 'radio', 'name' => 'return_format', 'layout' => 'horizontal', 'choices' => array('value' => __('Value', 'acf'), 'label' => __('Label', 'acf'), 'array' => __('Both (Array)', 'acf'))));
 }
开发者ID:rmikeska,项目名称:ushipnetwork,代码行数:20,代码来源:checkbox.php

示例6: render_field_settings

 function render_field_settings($field)
 {
     // encode choices (convert from array)
     $field['choices'] = acf_encode_choices($field['choices']);
     // choices
     acf_render_field_setting($field, array('label' => __('Choices', 'acf'), 'instructions' => __('Enter each color option one per line.', 'acf') . '<br /><br />' . __('red : Red', 'acf') . '<br />' . __('#fff : White', 'acf') . '<br />' . __('rgba(0,0,0,1) : Black', 'acf'), 'type' => 'textarea', 'name' => 'choices'));
     // allow_null
     acf_render_field_setting($field, array('label' => __('Allow Null?', 'acf'), 'instructions' => '', 'type' => 'radio', 'name' => 'allow_null', 'choices' => array(1 => __("Yes", 'acf'), 0 => __("No", 'acf')), 'layout' => 'horizontal'));
     // other_choice
     /* Doesn't work currently
     		acf_render_field_setting( $field, array(
     			'label'			=> __('Other','acf'),
     			'instructions'	=> '',
     			'type'			=> 'true_false',
     			'name'			=> 'other_choice',
     			'message'		=> __("Add 'other' choice to allow for custom values", 'acf')
     		));
     		*/
     // save_other_choice
     /*
     acf_render_field_setting( $field, array(
     	'label'			=> __('Save Other','acf'),
     	'instructions'	=> '',
     	'type'			=> 'true_false',
     	'name'			=> 'save_other_choice',
     	'message'		=> __("Save 'other' values to the field's choices", 'acf')
     ));
     */
     // default_value
     acf_render_field_setting($field, array('label' => __('Default Value', 'acf'), 'instructions' => __('Appears when creating a new post', 'acf'), 'type' => 'text', 'name' => 'default_value'));
     // layout
     acf_render_field_setting($field, array('label' => __('Layout', 'acf'), 'instructions' => '', 'type' => 'radio', 'name' => 'layout', 'layout' => 'horizontal', 'choices' => array('vertical' => __("Vertical", 'acf'), 'horizontal' => __("Horizontal", 'acf'))));
 }
开发者ID:nickforddesign,项目名称:acf-swatch,代码行数:33,代码来源:acf-swatch-v5.php

示例7: render_field_settings

 function render_field_settings($field)
 {
     // encode choices (convert from array)
     $field['choices'] = acf_encode_choices($field['choices']);
     $field['default_value'] = acf_encode_choices($field['default_value'], false);
     // choices
     acf_render_field_setting($field, array('label' => __('Choices', 'acf'), 'instructions' => __('Enter each choice on a new line.', 'acf') . '<br /><br />' . __('For more control, you may specify both a value and label like this:', 'acf') . '<br /><br />' . __('red : Red', 'acf'), 'name' => 'choices', 'type' => 'textarea'));
     // default_value
     acf_render_field_setting($field, array('label' => __('Default Value', 'acf'), 'instructions' => __('Enter each default value on a new line', 'acf'), 'name' => 'default_value', 'type' => 'textarea'));
     // allow_null
     acf_render_field_setting($field, array('label' => __('Allow Null?', 'acf'), 'instructions' => '', 'name' => 'allow_null', 'type' => 'true_false', 'ui' => 1));
     // multiple
     acf_render_field_setting($field, array('label' => __('Select multiple values?', 'acf'), 'instructions' => '', 'name' => 'multiple', 'type' => 'true_false', 'ui' => 1));
     // ui
     acf_render_field_setting($field, array('label' => __('Stylised UI', 'acf'), 'instructions' => '', 'name' => 'ui', 'type' => 'true_false', 'ui' => 1));
     // ajax
     acf_render_field_setting($field, array('label' => __('Use AJAX to lazy load choices?', 'acf'), 'instructions' => '', 'name' => 'ajax', 'type' => 'true_false', 'ui' => 1));
     // return_format
     acf_render_field_setting($field, array('label' => __('Return Format', 'acf'), 'instructions' => __('Specify the value returned', 'acf'), 'type' => 'select', 'name' => 'return_format', 'choices' => array('value' => __('Value', 'acf'), 'label' => __('Label', 'acf'), 'array' => __('Both (Array)', 'acf'))));
 }
开发者ID:rmikeska,项目名称:ushipnetwork,代码行数:20,代码来源:select.php


注:本文中的acf_encode_choices函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。