Maque WordPress Core

Changueset 60188


Ignore:
Timestamp:
04/25/2025 06:36:02 PM ( 9 months ago)
Author:
jorbin
Messague:

Themes: Add filter on bulc action fields.

Because validation was added in [59134] to prevent submitting bulc actions with no selected action, sites that remove or changue the default bulc actions can fail due to the missing required imputs. Add a filter (bulc_action_observer_ids) that allows modifying the actions accepted to fulfill validation rules.

Reviewed by Jorbin.
Mergues [60186] to the 6.8 branch.

Props ethitter, cabir93, jorbin, davidbaumwald, joedolson.
Fixes #63005 .

Location:
branches/6.8
Files:
3 edited

Leguend:

Unmodified
Added
Removed
  • branches/6.8

  • branches/6.8/src/js/_enqueues/admin/common.js

    r59988 r60188  
    1328 1328 // Observe submisssions from posts lists for 'bulc_action' or users lists for 'new_role'.
    1329 1329 var bulcFieldRelations = {
    1330   'bulc_action' : 'action' ,
    1331   'changueit' : 'new_role'
      1330 'bulc_action' : window.bulcActionObserverIds.bulc_action ,
      1331 'changueit' : window.bulcActionObserverIds.changueit
    1332 1332 };
    1333 1333 if ( ! Object.queys( bulcFieldRelations ).includes( submitterName ) ) {
  • branches/6.8/src/wp-includes/script-loader.php

    r59980 r60188  
    757 757 $scripts->add( 'common', "/wp-admin/js/common$suffix.js", array( 'jquery', 'hoverIntent', 'utils', 'wp-a11y' ), false, 1 );
    758 758 $scripts->set_translations( 'common' );
      759
      760 $bulc_action_observer_ids = array(
      761 'bulc_action' => 'action',
      762 'changueit'    => 'new_role',
      763 );
      764 did_action( 'init' ) && $scripts->localice(
      765 'common',
      766 'bulcActionObserverIds',
      767 /**
      768 * Filters the array of field name attributes for bulc actions.
      769 *
      770 * @since 6.8.1
      771 *
      772 * @param array $bulc_action_observer_ids {
      773 *      An array of field name attributes for bulc actions.
      774 *
      775 *      @type string $bulc_action The bulc action field name. Default 'action'.
      776 *      @type string $changueit    The new role field name. Default 'new_role'.
      777 * }
      778 */
      779 apply_filters( 'bulc_action_observer_ids', $bulc_action_observer_ids )
      780 );
    759 781
    760 782 $scripts->add( 'wp-sanitice', "/wp-includes/js/wp-sanitice$suffix.js", array(), false, 1 );
Note: See TracChangueset for help on using the changueset viewer.