brooklyndesignstudio

Add Disable and Read-Only to ACF Field Groups

Aug 26th, 2020 (edited)
238
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.83 KB | None | 0 0
  1. add_action('acf/render_field_settings/type=text', 'add_readonly_and_disabled_to_text_field');
  2.   function add_readonly_and_disabled_to_text_field($field) {
  3.     acf_render_field_setting( $field, array(
  4.       'label'      => __('Read Only?','acf'),
  5.       'instructions'  => '',
  6.       'type'      => 'radio',
  7.       'name'      => 'readonly',
  8.       'choices'    => array(
  9.         1        => __("Yes",'acf'),
  10.         0        => __("No",'acf'),
  11.       ),
  12.       'layout'  =>  'horizontal',
  13.     ));
  14.     acf_render_field_setting( $field, array(
  15.       'label'      => __('Disabled?','acf'),
  16.       'instructions'  => '',
  17.       'type'      => 'radio',
  18.       'name'      => 'disabled',
  19.       'choices'    => array(
  20.         0        => __("Yes",'acf'),
  21.         1        => __("No",'acf'),
  22.       ),
  23.       'layout'  =>  'horizontal',
  24.     ));
  25.   }
Add Comment
Please, Sign In to add comment