fewbricks\acf\field_group::add_common_field PHP Method

add_common_field() public method

public add_common_field ( string $common_field_array_key, string $key, array $settings = [] )
$common_field_array_key string A key corresponding to an item in the fewbricks_common_fields array
$key string A site wide unique key for the field
$settings array Anye extra settings to set on the field. Can be used to override existing settings as well.
    public function add_common_field($common_field_array_key, $key, $settings = [])
    {
        global $fewbricks_common_fields;
        if (isset($fewbricks_common_fields[$common_field_array_key])) {
            $field = clone $fewbricks_common_fields[$common_field_array_key];
            /** @noinspection PhpUndefinedMethodInspection */
            $field->set_setting('key', $key);
            /** @noinspection PhpUndefinedMethodInspection */
            $field->set_settings($settings);
            $this->add_field($field);
        }
    }