Themes: Add filter on bulk action fields.
Because validation was added in [59134] to prevent submitting bulk actions with no selected action, sites that remove or change the default bulk actions can fail due to the missing required inputs. Add a filter (bulk_action_observer_ids) that allows modifying the actions accepted to fulfill validation rules. Reviewed by Jorbin. Merges [60186] to the 6.8 branch. Props ethitter, kabir93, jorbin, davidbaumwald, joedolson. Fixes #63005. Built from https://develop.svn.wordpress.org/branches/6.8@60188 git-svn-id: http://core.svn.wordpress.org/branches/6.8@59524 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
@@ -1327,8 +1327,8 @@ $( function() {
|
|||||||
|
|
||||||
// Observe submissions from posts lists for 'bulk_action' or users lists for 'new_role'.
|
// Observe submissions from posts lists for 'bulk_action' or users lists for 'new_role'.
|
||||||
var bulkFieldRelations = {
|
var bulkFieldRelations = {
|
||||||
'bulk_action' : 'action',
|
'bulk_action' : window.bulkActionObserverIds.bulk_action,
|
||||||
'changeit' : 'new_role'
|
'changeit' : window.bulkActionObserverIds.changeit
|
||||||
};
|
};
|
||||||
if ( ! Object.keys( bulkFieldRelations ).includes( submitterName ) ) {
|
if ( ! Object.keys( bulkFieldRelations ).includes( submitterName ) ) {
|
||||||
return;
|
return;
|
||||||
|
|||||||
2
wp-admin/js/common.min.js
vendored
2
wp-admin/js/common.min.js
vendored
File diff suppressed because one or more lines are too long
@@ -757,6 +757,28 @@ function wp_default_scripts( $scripts ) {
|
|||||||
$scripts->add( 'common', "/wp-admin/js/common$suffix.js", array( 'jquery', 'hoverIntent', 'utils', 'wp-a11y' ), false, 1 );
|
$scripts->add( 'common', "/wp-admin/js/common$suffix.js", array( 'jquery', 'hoverIntent', 'utils', 'wp-a11y' ), false, 1 );
|
||||||
$scripts->set_translations( 'common' );
|
$scripts->set_translations( 'common' );
|
||||||
|
|
||||||
|
$bulk_action_observer_ids = array(
|
||||||
|
'bulk_action' => 'action',
|
||||||
|
'changeit' => 'new_role',
|
||||||
|
);
|
||||||
|
did_action( 'init' ) && $scripts->localize(
|
||||||
|
'common',
|
||||||
|
'bulkActionObserverIds',
|
||||||
|
/**
|
||||||
|
* Filters the array of field name attributes for bulk actions.
|
||||||
|
*
|
||||||
|
* @since 6.8.1
|
||||||
|
*
|
||||||
|
* @param array $bulk_action_observer_ids {
|
||||||
|
* An array of field name attributes for bulk actions.
|
||||||
|
*
|
||||||
|
* @type string $bulk_action The bulk action field name. Default 'action'.
|
||||||
|
* @type string $changeit The new role field name. Default 'new_role'.
|
||||||
|
* }
|
||||||
|
*/
|
||||||
|
apply_filters( 'bulk_action_observer_ids', $bulk_action_observer_ids )
|
||||||
|
);
|
||||||
|
|
||||||
$scripts->add( 'wp-sanitize', "/wp-includes/js/wp-sanitize$suffix.js", array(), false, 1 );
|
$scripts->add( 'wp-sanitize', "/wp-includes/js/wp-sanitize$suffix.js", array(), false, 1 );
|
||||||
|
|
||||||
$scripts->add( 'sack', "/wp-includes/js/tw-sack$suffix.js", array(), '1.6.1', 1 );
|
$scripts->add( 'sack', "/wp-includes/js/tw-sack$suffix.js", array(), '1.6.1', 1 );
|
||||||
|
|||||||
@@ -16,7 +16,7 @@
|
|||||||
*
|
*
|
||||||
* @global string $wp_version
|
* @global string $wp_version
|
||||||
*/
|
*/
|
||||||
$wp_version = '6.8.1-alpha-60187';
|
$wp_version = '6.8.1-alpha-60188';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.
|
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.
|
||||||
|
|||||||
Reference in New Issue
Block a user