@@ -40,6 +40,7 @@ function __construct() {
4040 'default_value ' => '' ,
4141 'other_choice ' => 0 ,
4242 'save_other_choice ' => 0 ,
43+ 'return_format ' => 'value '
4344 );
4445 $ this ->settings = array (
4546 'basename ' => plugin_basename ( __FILE__ ),
@@ -298,6 +299,20 @@ function render_field_settings( $field ) {
298299 )
299300 ));
300301
302+ // return value
303+ acf_render_field_setting ( $ field , array (
304+ 'label ' => __ ('Return Value ' ,'acf ' ),
305+ 'instructions ' => __ ('Specify the returned value on front end ' ,'acf ' ),
306+ 'type ' => 'radio ' ,
307+ 'name ' => 'return_format ' ,
308+ 'layout ' => 'horizontal ' ,
309+ 'choices ' => array (
310+ 'value ' => __ ('Value ' ,'acf ' ),
311+ 'label ' => __ ('Label ' ,'acf ' ),
312+ 'array ' => __ ('Both (Array) ' ,'acf ' )
313+ )
314+ ));
315+
301316 }
302317
303318
@@ -414,6 +429,27 @@ function load_value( $value, $post_id, $field ) {
414429
415430 }
416431
432+ /*
433+ * format_value()
434+ *
435+ * This filter is appied to the $value after it is loaded from the db and before it is returned to the template
436+ *
437+ * @type filter
438+ * @since 3.6
439+ * @date 23/01/13
440+ *
441+ * @param $value (mixed) the value which was loaded from the database
442+ * @param $post_id (mixed) the $post_id from which the value was loaded
443+ * @param $field (array) the field array holding all the field options
444+ *
445+ * @return $value (mixed) the modified value
446+ */
447+ function format_value ( $ value , $ post_id , $ field ) {
448+
449+ return acf_get_field_type ('select ' )->format_value ( $ value , $ post_id , $ field );
450+
451+ }
452+
417453 function input_admin_enqueue_scripts () {
418454
419455 // vars
@@ -442,4 +478,4 @@ function input_admin_enqueue_scripts() {
442478
443479new acf_field_swatch ();
444480
445- endif ;
481+ endif ;
0 commit comments