Make WordPress Core


Ignore:
Timestamp:
07/01/2020 01:08:11 PM (5 years ago)
Author:
gziolo
Message:

Editor: Support filtering arguments in block type registration

Adds possibility to filter the settings of a block type during its registration.

Props aduth, azaozz.
Fixes #49615.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-includes/class-wp-block-type.php

    r48118 r48263  
    263263        $args['name'] = $this->name;
    264264
     265        /**
     266         * Filters the arguments for registering a block type.
     267         *
     268         * @since 5.5.0
     269         *
     270         * @param array  $args       Array of arguments for registering a
     271         *                           block type.
     272         * @param string $block_type Block type name including namespace.
     273         */
     274        $args = apply_filters( 'register_block_type_args', $args, $this->name );
     275
    265276        foreach ( $args as $property_name => $property_value ) {
    266277            $this->$property_name = $property_value;
Note: See TracChangeset for help on using the changeset viewer.