• Resolved willlaw

    (@willlaw)


    Hi i’d like to know the name of the field type and its parameters so that I can programatically add the this field in php with acf_add_local_field()

    Thanks

    • This topic was modified 6 years, 3 months ago by willlaw.
Viewing 1 replies (of 1 total)
  • Plugin Author Matt Keys

    (@mattkeys)

    I am not positive how this plugin will work along with this function as I’ve never tried it, but you can probably find everything you need by looking in this file:

    advanced-custom-fields-font-awesome/fields/acf-font-awesome-v5.php

    			$this->name = 'font-awesome';	
    			$this->label = __( 'Font Awesome Icon', 'acf-font-awesome');
    			$this->category = 'content';
    			$this->settings = $settings;
    
    			$this->defaults = array(
    				'enqueue_fa' 		=>	0,
    				'allow_null' 		=>	0,
    				'show_preview'		=>	1,
    				'save_format'		=>  'element',
    				'default_value'		=>	'',
    				'fa_live_preview'	=>	'',
    				'choices'			=>	$this->get_icons('list')
    			);

    Where you might run into trouble is the ‘choices’ part of the parameters as this is not a fixed list, it is retrieved programmatically so that it keeps up to date with FontAwesome releases.

    You will see that there is a filter you can use though to get the icons, check out the get_icons() function in that file for an example of how it is used.

    Hope this helps,

    Matt Keys

Viewing 1 replies (of 1 total)
  • The topic ‘What is the Field type name’ is closed to new replies.