Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions src/wp-includes/class-wp-entity-actions-registry.php
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ class WP_Entity_Actions_Registry {
* @var array<string, string[]>
*/
const SUPPORTED_VALUES = array(
'context' => array( 'list', 'single' ),
'context' => array( 'list' ),
'modalSize' => array( 'small', 'medium', 'large', 'fill' ),
);

Expand Down Expand Up @@ -230,8 +230,8 @@ public function register( $origin, $kind, $name, $actions, $script_module = null
* _doing_it_wrong().
*
* A value DataViews does not support is otherwise silent: an action
* whose `context` is not `list` or `single` shows on no screen. Such a
* value is kept, like the field types the fields registry reports.
* whose `context` is not `list` shows on no screen. Such a value is
* kept, like the field types the fields registry reports.
* `callback`, `RenderModal`, and `isEligible` are functions and
* components, which only a script module can provide: a value set on
* the server would be called on the client and fail, so it is removed.
Expand Down
6 changes: 3 additions & 3 deletions tests/phpunit/tests/entity-actions.php
Original file line number Diff line number Diff line change
Expand Up @@ -741,7 +741,7 @@ public function test_registering_an_action_with_invalid_values_is_reported() {
array(
'id' => 'archive',
'label' => 'Archive',
'context' => 'lists',
'context' => 'single',
'isEligible' => true,
),
array(
Expand All @@ -754,12 +754,12 @@ public function test_registering_an_action_with_invalid_values_is_reported() {

$this->assertSame( array( 'feature', 'archive', 'export' ), $registered, 'The actions are registered anyway.' );
$actions = array_column( wp_get_registered_entity_actions( 'postType', 'page' ), null, 'id' );
$this->assertSame( 'lists', $actions['archive']['context'], 'A value DataViews does not support is kept.' );
$this->assertSame( 'single', $actions['archive']['context'], 'A value DataViews does not support is kept.' );
$this->assertSame( 'huge', $actions['export']['modalSize'], 'A value DataViews does not support is kept.' );
$this->assertArrayNotHasKey( 'isEligible', $actions['archive'], 'A property only a script module can provide is removed.' );
$this->assertCount( 1, $reported );
$this->assertStringContainsString( 'postType "page"', $reported[0], 'The notice names the entity.' );
$this->assertStringContainsString( ': archive (context is not one of list and single.)', $reported[0], 'The notice names the action and its value DataViews does not support.' );
$this->assertStringContainsString( ': archive (context is not one of list.)', $reported[0], 'The notice names the action and its value DataViews does not support.' );
$this->assertStringContainsString( 'archive (isEligible can only come from a script module', $reported[0], 'The notice names the property that is removed.' );
$this->assertStringContainsString( 'export (modalSize is not one of small, medium, large, and fill.)', $reported[0], 'The notice names every value DataViews does not support.' );
$this->assertStringNotContainsString( 'feature', $reported[0], 'The other actions of the call are not reported.' );
Expand Down
Loading