carbon-fields
carbon-fields copied to clipboard
Ability to filter/translate Complex Field labels texts
Version
- Carbon Fields: 3.3.4
- WordPress: 6.0.1
- PHP: 7.4
Expected Behavior
I would expect to be able to filter / translate all texts used throughout the library.
Actual Behavior
Some texts have been hard-coded in and are impossible to filter/translate, such as the Complex Field labels in htmlburger\carbon-fields\core\Field\Complex_Field.php copied below:
/**
* Entry labels
* These are translated in init()
*
* @var array
*/
public $labels = array(
'singular_name' => 'Entry',
'plural_name' => 'Entries',
);
Container definition
N/A
Steps to Reproduce the Problem
- Add any Complex field
Comments
The perfect solution would be to be able to both filter and translate these labels, would you accept a PR that updates the function above to this other version?:
/**
* Entry labels
* These are translated in init()
*
* @var array
*/
public $labels = apply_filters('carbon_fields_complex_field_labels', array(
'singular_name' => __('Entry', 'carbon-fields' ),
'plural_name' => __('Entries', 'carbon-fields' ),
) );
Thank you for your consideration and for Carbon Fields in general, I love to use this library in my WP projects :)