Support

Account

Home Forums Feature Requests Group Options (acf_render_field_wrap) is there an officiel way to do this?

Solved

Group Options (acf_render_field_wrap) is there an officiel way to do this?

  • Hi,
    I’m using ACF Pro 5 latest.

    My field group needs a custom option (for the whole group, not for its fields), like this:

    Group Option

    So I played around the code and found I only had to had a new group to wp-content/plugins/advanced-custom-fields-pro/admin/views/field-group-options.php and add the default value into wp-content/plugins/advanced-custom-fields-pro/api/api-field-group.php:

    
    // grid width
    acf_render_field_wrap(array(
    	'label'			=> __('Largeur du groupe','acf'),
    	'instructions'	=> __('Largeur du template comportant cette grille de contenus','acf'),
    	'type'			=> 'number',
    	'name'			=> 'grid_width',
    	'prefix'		=> 'acf_field_group',
    	'append'		=> 'px',
    	'value'			=> $field_group['grid_width'],
    ), 'tr');
    

    and

    function acf_get_valid_field_group( $field_group = false ) {
    	
    	// parse in defaults
    	$field_group = acf_parse_args( $field_group, array(
    		'ID'					=> 0,
    		// (...)
    		'hide_on_screen'		=> array(),
    		'grid_width'			=> 590,
    	));
    
    // (...)
    

    Of course since I am editing ACF’s core files, my custom group options will go away at the next upgrade of the plugin.

    So, is there an official way to do this?

    I couldn’t find any reference to acf_render_field_wrap().

    Thanks for reading!
    Cookies for answering 🙂

  • Hey,

    did you find a solution for it? I have the same issue.

    Greetings

  • Hi @endcore, unfortunately I got no reply from the Support so I ended up with disabling auto-update of the plugin (by removing the key used for the pro version) and copy/pasting my custom edits each time a new version is out.

    Obviously this is not a professional way to maintain a site, so I hope this featured will be official soon.

    Don’t forget to reply to this topic if you find a way!

    • Elliot

    • May 22, 2015 at 9:35 am

    Hi guys

    Thanks for the topic and ideas.

    I’ve just added in a new action (to the next version not yet released 5.2.6):
    ‘acf/render_field_group_settings’

    You will be able to use it like this:

    
    add_action('acf/render_field_group_settings', 'my_function', 10, 1);
    
    function my_function( $field_group ) {
    
    }
    
  • <3

  • Why don’t you add this action to the documentation? Hard to find it with the google search.

Viewing 6 posts - 1 through 6 (of 6 total)

You must be logged in to reply to this topic.

We use cookies to offer you a better browsing experience, analyze site traffic and personalize content. Read about how we use cookies and how you can control them in our Cookie Policy. If you continue to use this site, you consent to our use of cookies.