Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Please add formatting options #17

Open
Pondake opened this issue Mar 20, 2019 · 1 comment
Open

Please add formatting options #17

Pondake opened this issue Mar 20, 2019 · 1 comment

Comments

@Pondake
Copy link

Pondake commented Mar 20, 2019

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'];
@alexanderdejong
Copy link

thank you for this guide! @Pondake

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants