ACF-Image-Select
ACF-Image-Select copied to clipboard
Please add formatting options
Please add this:
acf_render_field_setting( $field, array(
'label' => __('Return Format','acf'),
'instructions' => '',
'type' => 'radio',
'name' => 'return_format',
'choices' => array(
'url' => __("URL",'acf'),
'val' => __("Choice value",'acf'),
),
'layout' => 'horizontal',
));
Below "acf render field setting, image extension". And:
$this->name = 'image_select';
$this->label = __('Image Select');
$this->category = __("Choice",'acf');
$this->defaults = array(
'choices' => array(),
'default_value' => '',
'multiple' => 0,
'return_format' => 'url',
'image_path' => get_template_directory_uri() . '/images/',
'image_extension' => 'png',
);
To support it with a default value.
And:
if( $field['return_format'] == 'url' ) {
$retvalue = $field['image_path'] . esc_attr($value) . '.'.$field['image_extension'];
} else {
$retvalue = esc_attr($value);
}
Within format value, replacing
$retvalue = $field['image_path'] . esc_attr($value) . '.'.$field['image_extension'];
thank you for this guide! @Pondake