Skip to content

Commit b0e62d8

Browse files
Docs: Require view config filter callbacks to return the container.
Corrects the get_entity_view_config_{$kind}_{$name} filter docblock: callbacks must return the container they receive. Also fixes a doubled "the" in the same paragraph. Follow-up to [62825]. Props jorgefilipecosta, oandregal. Fixes #65577. git-svn-id: https://develop.svn.wordpress.org/trunk@62833 602fd350-edb4-49c9-b593-d223f7449a82
1 parent 2459eed commit b0e62d8

1 file changed

Lines changed: 6 additions & 4 deletions

File tree

src/wp-includes/class-wp-view-config-data.php

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -159,10 +159,12 @@ public function apply_filters( $kind, $name ) {
159159
* individual list members.
160160
*
161161
* A change that declares an unsupported schema version is rejected and does
162-
* not alter anything. Callbacks mutate the container in place, so there is no
163-
* need to return it; any returned value is ignored. Callbacks must not replace
164-
* the container with a different value, as later callbacks receive whatever the
165-
* the previous one returned.
162+
* not alter anything. As with any filter, each callback's return value is
163+
* passed to the next callback as `$data`, so callbacks must return the
164+
* container they received: a callback that returns nothing, or any other
165+
* value, hands that result to every callback hooked at a later priority
166+
* instead of the container. Since the write methods return the container,
167+
* a callback can end with `return $data->merge( $patch, $version );`.
166168
*
167169
* @since 7.1.0
168170
*

0 commit comments

Comments
 (0)