plugin updates
This commit is contained in:
@@ -78,8 +78,9 @@ if ( ! class_exists( 'acf_field' ) ) :
|
||||
$this->add_action( 'acf/field_group/admin_head', array( $this, 'field_group_admin_head' ), 10, 0 );
|
||||
$this->add_action( 'acf/field_group/admin_footer', array( $this, 'field_group_admin_footer' ), 10, 0 );
|
||||
|
||||
// Most fields can use the "Required" validation setting as well as most presentation settings.
|
||||
// Add field global settings configurable by supports on specific field types.
|
||||
$this->add_field_action( 'acf/field_group/render_field_settings_tab/validation', array( $this, 'render_required_setting' ), 5 );
|
||||
$this->add_field_action( 'acf/field_group/render_field_settings_tab/presentation', array( $this, 'render_bindings_setting' ), 5 );
|
||||
|
||||
foreach ( acf_get_combined_field_type_settings_tabs() as $tab_key => $tab_label ) {
|
||||
$this->add_field_action( "acf/field_group/render_field_settings_tab/{$tab_key}", array( $this, "render_field_{$tab_key}_settings" ), 9, 1 );
|
||||
@@ -318,6 +319,53 @@ if ( ! class_exists( 'acf_field' ) ) :
|
||||
true
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Renders the "Allow in Bindings" setting on the field type "Presentation" settings tab.
|
||||
*
|
||||
* @since 6.3.6
|
||||
*
|
||||
* @param array $field The field type being rendered.
|
||||
* @return void
|
||||
*/
|
||||
public function render_bindings_setting( $field ) {
|
||||
$supports_bindings = acf_field_type_supports( $field['type'], 'bindings', true );
|
||||
|
||||
// Only prevent rendering if explicitly disabled.
|
||||
if ( ! $supports_bindings ) {
|
||||
return;
|
||||
}
|
||||
|
||||
/* translators: %s A "Learn More" link to documentation explaining the setting further. */
|
||||
$binding_string = esc_html__( 'Allow content editors to access and display the field value in the editor UI using Block Bindings or the ACF Shortcode. %s', 'acf' );
|
||||
$binding_url = '<a target="_blank" href="' . acf_add_url_utm_tags( 'https://www.advancedcustomfields.com/resources/bindings-security/', 'docs', 'field-settings' ) . '">' . esc_html__( 'Learn more.', 'acf' ) . '</a>';
|
||||
$binding_instructions = sprintf(
|
||||
$binding_string,
|
||||
$binding_url
|
||||
);
|
||||
|
||||
// This field setting has a unique behaviour. If the value isn't defined on the field object, it defaults to true, but for new fields, it defaults to off.
|
||||
if ( ! isset( $field['allow_in_bindings'] ) ) {
|
||||
if ( empty( $field['ID'] ) ) {
|
||||
$field['allow_in_bindings'] = false;
|
||||
} else {
|
||||
$field['allow_in_bindings'] = true;
|
||||
}
|
||||
}
|
||||
|
||||
acf_render_field_setting(
|
||||
$field,
|
||||
array(
|
||||
'label' => __( 'Allow Access to Value in Editor UI', 'acf' ),
|
||||
'instructions' => $binding_instructions,
|
||||
'type' => 'true_false',
|
||||
'name' => 'allow_in_bindings',
|
||||
'ui' => 1,
|
||||
'class' => 'field-show-in-bindings',
|
||||
),
|
||||
true
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
endif; // class_exists check
|
||||
|
||||
Reference in New Issue
Block a user