@@ -41,7 +41,7 @@ discard block |
||
| 41 | 41 | * @return bool |
| 42 | 42 | */ |
| 43 | 43 | public function has_errors(): bool { |
| 44 | - return count( $this->errors ) >= 1; |
|
| 44 | + return count($this->errors) >= 1; |
|
| 45 | 45 | } |
| 46 | 46 | |
| 47 | 47 | /** |
@@ -59,7 +59,7 @@ discard block |
||
| 59 | 59 | * @param string $error |
| 60 | 60 | * @return self |
| 61 | 61 | */ |
| 62 | - public function add_error( string $error ): self { |
|
| 62 | + public function add_error(string $error): self { |
|
| 63 | 63 | $this->errors[] = $error; |
| 64 | 64 | return $this; |
| 65 | 65 | } |
@@ -80,5 +80,5 @@ discard block |
||
| 80 | 80 | * @param \PinkCrab\Registerables\Module\Middleware\Registerable $object_instance |
| 81 | 81 | * @return bool |
| 82 | 82 | */ |
| 83 | - abstract public function validate( Registerable $object_instance ): bool; |
|
| 83 | + abstract public function validate(Registerable $object_instance): bool; |
|
| 84 | 84 | } |
@@ -31,7 +31,7 @@ discard block |
||
| 31 | 31 | |
| 32 | 32 | class Taxonomy_Validator extends Abstract_Validator { |
| 33 | 33 | |
| 34 | - protected const REQUIRED_FIELDS = array( 'slug', 'singular', 'plural' ); |
|
| 34 | + protected const REQUIRED_FIELDS = array('slug', 'singular', 'plural'); |
|
| 35 | 35 | |
| 36 | 36 | /** |
| 37 | 37 | * Validates the class passed. |
@@ -39,17 +39,17 @@ discard block |
||
| 39 | 39 | * @param \PinkCrab\Registerables\Module\Middleware\Registerable $object_instance |
| 40 | 40 | * @return bool |
| 41 | 41 | */ |
| 42 | - public function validate( Registerable $object_instance ): bool { |
|
| 42 | + public function validate(Registerable $object_instance): bool { |
|
| 43 | 43 | // If this is not a valid taxonomy, just bail here. |
| 44 | - if ( ! is_a( $object_instance, Taxonomy::class ) ) { |
|
| 45 | - $this->add_error( sprintf( '%s is not a valid Taxonomy Model', get_class( $object_instance ) ) ); |
|
| 44 | + if ( ! is_a($object_instance, Taxonomy::class)) { |
|
| 45 | + $this->add_error(sprintf('%s is not a valid Taxonomy Model', get_class($object_instance))); |
|
| 46 | 46 | return false; |
| 47 | 47 | } |
| 48 | 48 | |
| 49 | 49 | /* @var Taxonomy $object_instance, already confirmed as a Taxonomy */ |
| 50 | 50 | |
| 51 | 51 | // Ensure all required fields are set. |
| 52 | - $this->has_required_fields( $object_instance ); |
|
| 52 | + $this->has_required_fields($object_instance); |
|
| 53 | 53 | |
| 54 | 54 | // Check if the passed object has any errors. |
| 55 | 55 | return ! $this->has_errors(); |
@@ -61,12 +61,12 @@ discard block |
||
| 61 | 61 | * @param Taxonomy $taxonomy |
| 62 | 62 | * @return void |
| 63 | 63 | */ |
| 64 | - protected function has_required_fields( Taxonomy $taxonomy ): void { |
|
| 65 | - foreach ( self::REQUIRED_FIELDS as $field ) { |
|
| 66 | - if ( ! is_string( $taxonomy->{$field} ) |
|
| 67 | - || \mb_strlen( $taxonomy->{$field} ) === 0 |
|
| 64 | + protected function has_required_fields(Taxonomy $taxonomy): void { |
|
| 65 | + foreach (self::REQUIRED_FIELDS as $field) { |
|
| 66 | + if ( ! is_string($taxonomy->{$field} ) |
|
| 67 | + || \mb_strlen($taxonomy->{$field} ) === 0 |
|
| 68 | 68 | ) { |
| 69 | - $this->add_error( sprintf( '%s is not set on %s Taxonomy Model', $field, get_class( $taxonomy ) ) ); |
|
| 69 | + $this->add_error(sprintf('%s is not set on %s Taxonomy Model', $field, get_class($taxonomy))); |
|
| 70 | 70 | } |
| 71 | 71 | } |
| 72 | 72 | } |
@@ -31,7 +31,7 @@ discard block |
||
| 31 | 31 | |
| 32 | 32 | class Post_Type_Validator extends Abstract_Validator { |
| 33 | 33 | |
| 34 | - protected const REQUIRED_FIELDS = array( 'key', 'singular', 'plural' ); |
|
| 34 | + protected const REQUIRED_FIELDS = array('key', 'singular', 'plural'); |
|
| 35 | 35 | |
| 36 | 36 | /** |
| 37 | 37 | * Validates the class passed. |
@@ -39,17 +39,17 @@ discard block |
||
| 39 | 39 | * @param \PinkCrab\Registerables\Module\Middleware\Registerable $object_instance |
| 40 | 40 | * @return bool |
| 41 | 41 | */ |
| 42 | - public function validate( Registerable $object_instance ): bool { |
|
| 42 | + public function validate(Registerable $object_instance): bool { |
|
| 43 | 43 | // If this is not a valid post type, just bail here. |
| 44 | - if ( ! is_a( $object_instance, Post_Type::class ) ) { |
|
| 45 | - $this->add_error( sprintf( '%s is not a valid Post Type Model', get_class( $object_instance ) ) ); |
|
| 44 | + if ( ! is_a($object_instance, Post_Type::class)) { |
|
| 45 | + $this->add_error(sprintf('%s is not a valid Post Type Model', get_class($object_instance))); |
|
| 46 | 46 | return false; |
| 47 | 47 | } |
| 48 | 48 | |
| 49 | 49 | /* @var Post_Type $object_instance, already confirmed as a post type */ |
| 50 | 50 | |
| 51 | 51 | // Ensure all required fields are set. |
| 52 | - $this->has_required_fields( $object_instance ); |
|
| 52 | + $this->has_required_fields($object_instance); |
|
| 53 | 53 | |
| 54 | 54 | // Check if the passed object_instance has any errors. |
| 55 | 55 | return ! $this->has_errors(); |
@@ -61,12 +61,12 @@ discard block |
||
| 61 | 61 | * @param Post_Type $post_type |
| 62 | 62 | * @return void |
| 63 | 63 | */ |
| 64 | - protected function has_required_fields( Post_Type $post_type ): void { |
|
| 65 | - foreach ( self::REQUIRED_FIELDS as $field ) { |
|
| 66 | - if ( ! is_string( $post_type->{$field} ) |
|
| 67 | - || \mb_strlen( $post_type->{$field} ) === 0 |
|
| 64 | + protected function has_required_fields(Post_Type $post_type): void { |
|
| 65 | + foreach (self::REQUIRED_FIELDS as $field) { |
|
| 66 | + if ( ! is_string($post_type->{$field} ) |
|
| 67 | + || \mb_strlen($post_type->{$field} ) === 0 |
|
| 68 | 68 | ) { |
| 69 | - $this->add_error( sprintf( '%s is not set on %s Post Type Model', $field, get_class( $post_type ) ) ); |
|
| 69 | + $this->add_error(sprintf('%s is not set on %s Post Type Model', $field, get_class($post_type))); |
|
| 70 | 70 | } |
| 71 | 71 | } |
| 72 | 72 | } |
@@ -32,7 +32,7 @@ discard block |
||
| 32 | 32 | |
| 33 | 33 | class Meta_Box_Validator extends Abstract_Validator { |
| 34 | 34 | |
| 35 | - protected const REQUIRED_FIELDS = array( 'key', 'label' ); |
|
| 35 | + protected const REQUIRED_FIELDS = array('key', 'label'); |
|
| 36 | 36 | |
| 37 | 37 | /** |
| 38 | 38 | * Validates the class passed. |
@@ -40,7 +40,7 @@ discard block |
||
| 40 | 40 | * @param \PinkCrab\Registerables\Module\Middleware\Registerable $object_instance |
| 41 | 41 | * @return bool |
| 42 | 42 | */ |
| 43 | - public function validate( Registerable $object_instance ): bool { // phpcs:ignore Generic.CodeAnalysis.UnusedFunctionParameter.FoundInExtendedClass |
|
| 43 | + public function validate(Registerable $object_instance): bool { // phpcs:ignore Generic.CodeAnalysis.UnusedFunctionParameter.FoundInExtendedClass |
|
| 44 | 44 | return false; //no op |
| 45 | 45 | } |
| 46 | 46 | |
@@ -50,20 +50,20 @@ discard block |
||
| 50 | 50 | * @param mixed $meta_box |
| 51 | 51 | * @return bool |
| 52 | 52 | */ |
| 53 | - public function verify_meta_box( $meta_box ): bool { |
|
| 53 | + public function verify_meta_box($meta_box): bool { |
|
| 54 | 54 | // If this is not a valid post type, just bail here. |
| 55 | - if ( ! is_object( $meta_box ) || ! is_a( $meta_box, Meta_Box::class ) ) { |
|
| 56 | - $this->add_error( sprintf( '%s is not a valid Meta Box Model', is_object( $meta_box ) ? get_class( $meta_box ) : \gettype( $meta_box ) ) ); |
|
| 55 | + if ( ! is_object($meta_box) || ! is_a($meta_box, Meta_Box::class)) { |
|
| 56 | + $this->add_error(sprintf('%s is not a valid Meta Box Model', is_object($meta_box) ? get_class($meta_box) : \gettype($meta_box))); |
|
| 57 | 57 | return false; |
| 58 | 58 | } |
| 59 | 59 | |
| 60 | 60 | /* @var Meta_Box $object, already confirmed as a post type */ |
| 61 | 61 | |
| 62 | 62 | // Ensure all required fields are set. |
| 63 | - $this->has_required_fields( $meta_box ); |
|
| 63 | + $this->has_required_fields($meta_box); |
|
| 64 | 64 | |
| 65 | 65 | // Ensure can render view. |
| 66 | - $this->has_valid_view( $meta_box ); |
|
| 66 | + $this->has_valid_view($meta_box); |
|
| 67 | 67 | |
| 68 | 68 | // Check if the passed object has any errors. |
| 69 | 69 | return ! $this->has_errors(); |
@@ -75,12 +75,12 @@ discard block |
||
| 75 | 75 | * @param Meta_Box $meta_box |
| 76 | 76 | * @return void |
| 77 | 77 | */ |
| 78 | - protected function has_required_fields( Meta_Box $meta_box ): void { |
|
| 79 | - foreach ( self::REQUIRED_FIELDS as $field ) { |
|
| 80 | - if ( ! is_string( $meta_box->{$field} ) |
|
| 81 | - || \mb_strlen( $meta_box->{$field} ) === 0 |
|
| 78 | + protected function has_required_fields(Meta_Box $meta_box): void { |
|
| 79 | + foreach (self::REQUIRED_FIELDS as $field) { |
|
| 80 | + if ( ! is_string($meta_box->{$field} ) |
|
| 81 | + || \mb_strlen($meta_box->{$field} ) === 0 |
|
| 82 | 82 | ) { |
| 83 | - $this->add_error( sprintf( '%s is not set on %s Meta Box Model', $field, get_class( $meta_box ) ) ); |
|
| 83 | + $this->add_error(sprintf('%s is not set on %s Meta Box Model', $field, get_class($meta_box))); |
|
| 84 | 84 | } |
| 85 | 85 | } |
| 86 | 86 | } |
@@ -92,11 +92,11 @@ discard block |
||
| 92 | 92 | * @param \PinkCrab\Registerables\Meta_Box $meta_box |
| 93 | 93 | * @return void |
| 94 | 94 | */ |
| 95 | - protected function has_valid_view( Meta_Box $meta_box ): void { |
|
| 96 | - if ( ! \is_callable( $meta_box->view ) |
|
| 97 | - && ( ! is_string( $meta_box->view_template ) || \mb_strlen( $meta_box->view_template ) === 0 ) |
|
| 95 | + protected function has_valid_view(Meta_Box $meta_box): void { |
|
| 96 | + if ( ! \is_callable($meta_box->view) |
|
| 97 | + && ( ! is_string($meta_box->view_template) || \mb_strlen($meta_box->view_template) === 0) |
|
| 98 | 98 | ) { |
| 99 | - $this->add_error( sprintf( '%s doesn\'t have a valid view defined.', get_class( $meta_box ) ) ); |
|
| 99 | + $this->add_error(sprintf('%s doesn\'t have a valid view defined.', get_class($meta_box))); |
|
| 100 | 100 | } |
| 101 | 101 | } |
| 102 | 102 | } |
@@ -107,7 +107,7 @@ discard block |
||
| 107 | 107 | * |
| 108 | 108 | * @param string $key |
| 109 | 109 | */ |
| 110 | - final public function __construct( string $key ) { |
|
| 110 | + final public function __construct(string $key) { |
|
| 111 | 111 | $this->key = $key; |
| 112 | 112 | } |
| 113 | 113 | |
@@ -117,8 +117,8 @@ discard block |
||
| 117 | 117 | * @param string $key |
| 118 | 118 | * @return self |
| 119 | 119 | */ |
| 120 | - public static function normal( string $key ): self { |
|
| 121 | - $meta_box = new static( $key ); |
|
| 120 | + public static function normal(string $key): self { |
|
| 121 | + $meta_box = new static($key); |
|
| 122 | 122 | $meta_box->context = 'normal'; |
| 123 | 123 | return $meta_box; |
| 124 | 124 | } |
@@ -129,8 +129,8 @@ discard block |
||
| 129 | 129 | * @param string $key |
| 130 | 130 | * @return self |
| 131 | 131 | */ |
| 132 | - public static function side( string $key ): self { |
|
| 133 | - $meta_box = new static( $key ); |
|
| 132 | + public static function side(string $key): self { |
|
| 133 | + $meta_box = new static($key); |
|
| 134 | 134 | $meta_box->context = 'side'; |
| 135 | 135 | return $meta_box; |
| 136 | 136 | } |
@@ -141,7 +141,7 @@ discard block |
||
| 141 | 141 | * @param string $label |
| 142 | 142 | * @return self |
| 143 | 143 | */ |
| 144 | - public function label( string $label ): self { |
|
| 144 | + public function label(string $label): self { |
|
| 145 | 145 | $this->label = $label; |
| 146 | 146 | return $this; |
| 147 | 147 | } |
@@ -152,8 +152,8 @@ discard block |
||
| 152 | 152 | * @param string|array<mixed>|\WP_Screen $screen |
| 153 | 153 | * @return self |
| 154 | 154 | */ |
| 155 | - public function screen( $screen ): self { |
|
| 156 | - array_push( $this->screen, $screen ); |
|
| 155 | + public function screen($screen): self { |
|
| 156 | + array_push($this->screen, $screen); |
|
| 157 | 157 | return $this; |
| 158 | 158 | } |
| 159 | 159 | |
@@ -163,7 +163,7 @@ discard block |
||
| 163 | 163 | * @param array<string, mixed> $view_vars |
| 164 | 164 | * @return self |
| 165 | 165 | */ |
| 166 | - public function view_vars( array $view_vars ): self { |
|
| 166 | + public function view_vars(array $view_vars): self { |
|
| 167 | 167 | $this->view_vars = $view_vars; |
| 168 | 168 | return $this; |
| 169 | 169 | } |
@@ -175,7 +175,7 @@ discard block |
||
| 175 | 175 | * @param string $view_template |
| 176 | 176 | * @return self |
| 177 | 177 | */ |
| 178 | - public function view_template( string $view_template ): self { |
|
| 178 | + public function view_template(string $view_template): self { |
|
| 179 | 179 | $this->view_template = $view_template; |
| 180 | 180 | return $this; |
| 181 | 181 | } |
@@ -187,7 +187,7 @@ discard block |
||
| 187 | 187 | * @param callable $view_callback |
| 188 | 188 | * @return self |
| 189 | 189 | */ |
| 190 | - public function view( $view_callback ): self { |
|
| 190 | + public function view($view_callback): self { |
|
| 191 | 191 | $this->view = $view_callback; |
| 192 | 192 | return $this; |
| 193 | 193 | } |
@@ -201,8 +201,8 @@ discard block |
||
| 201 | 201 | * @param int $params |
| 202 | 202 | * @return self |
| 203 | 203 | */ |
| 204 | - public function add_action( string $hook, callable $callback, int $priority = 10, int $params = 1 ): self { |
|
| 205 | - $this->actions[ $hook ] = |
|
| 204 | + public function add_action(string $hook, callable $callback, int $priority = 10, int $params = 1): self { |
|
| 205 | + $this->actions[$hook] = |
|
| 206 | 206 | array( |
| 207 | 207 | 'callback' => $callback, |
| 208 | 208 | 'priority' => $priority, |
@@ -218,7 +218,7 @@ discard block |
||
| 218 | 218 | * @param callable(\WP_Post $post,array<string, mixed> $args):array<string, mixed> $view_data_filter |
| 219 | 219 | * @return self |
| 220 | 220 | */ |
| 221 | - public function view_data_filter( callable $view_data_filter ): self { |
|
| 221 | + public function view_data_filter(callable $view_data_filter): self { |
|
| 222 | 222 | $this->view_data_filter = $view_data_filter; |
| 223 | 223 | return $this; |
| 224 | 224 | } |
@@ -51,27 +51,27 @@ discard block |
||
| 51 | 51 | * @param Registerable $class_instance |
| 52 | 52 | * @return object |
| 53 | 53 | */ |
| 54 | - public function process( object $class_instance ): object { |
|
| 55 | - if ( ! is_a( $class_instance, Registerable::class ) ) { |
|
| 54 | + public function process(object $class_instance): object { |
|
| 55 | + if ( ! is_a($class_instance, Registerable::class)) { |
|
| 56 | 56 | return $class_instance; |
| 57 | 57 | } |
| 58 | 58 | |
| 59 | 59 | // Based on the registerable type. |
| 60 | - switch ( true ) { |
|
| 61 | - case is_a( $class_instance, Post_Type::class ): |
|
| 62 | - $this->process_post_type( $class_instance ); |
|
| 60 | + switch (true) { |
|
| 61 | + case is_a($class_instance, Post_Type::class): |
|
| 62 | + $this->process_post_type($class_instance); |
|
| 63 | 63 | break; |
| 64 | 64 | |
| 65 | - case is_a( $class_instance, Taxonomy::class ): |
|
| 66 | - $this->process_taxonomy( $class_instance ); |
|
| 65 | + case is_a($class_instance, Taxonomy::class): |
|
| 66 | + $this->process_taxonomy($class_instance); |
|
| 67 | 67 | break; |
| 68 | 68 | |
| 69 | - case is_a( $class_instance, Shared_Meta_Box_Controller::class ): |
|
| 70 | - $this->process_shared_meta_box( $class_instance ); |
|
| 69 | + case is_a($class_instance, Shared_Meta_Box_Controller::class): |
|
| 70 | + $this->process_shared_meta_box($class_instance); |
|
| 71 | 71 | break; |
| 72 | 72 | |
| 73 | - case is_a( $class_instance, Additional_Meta_Data_Controller::class ): |
|
| 74 | - $this->process_additional_meta_data( $class_instance ); |
|
| 73 | + case is_a($class_instance, Additional_Meta_Data_Controller::class): |
|
| 74 | + $this->process_additional_meta_data($class_instance); |
|
| 75 | 75 | break; |
| 76 | 76 | |
| 77 | 77 | default: |
@@ -89,13 +89,13 @@ discard block |
||
| 89 | 89 | * @return void |
| 90 | 90 | * @since 0.7.0 |
| 91 | 91 | */ |
| 92 | - protected function process_taxonomy( Taxonomy $taxonomy ): void { |
|
| 92 | + protected function process_taxonomy(Taxonomy $taxonomy): void { |
|
| 93 | 93 | $this->loader->action( |
| 94 | 94 | 'init', |
| 95 | - static function () use ( $taxonomy ) { |
|
| 95 | + static function() use ($taxonomy) { |
|
| 96 | 96 | Registrar_Factory::new() |
| 97 | - ->create_from_registerable( $taxonomy ) |
|
| 98 | - ->register( $taxonomy ); |
|
| 97 | + ->create_from_registerable($taxonomy) |
|
| 98 | + ->register($taxonomy); |
|
| 99 | 99 | } |
| 100 | 100 | ); |
| 101 | 101 | } |
@@ -107,21 +107,21 @@ discard block |
||
| 107 | 107 | * @return void |
| 108 | 108 | * @since 0.7.0 |
| 109 | 109 | */ |
| 110 | - protected function process_post_type( Post_Type $post_type_registerable ) { |
|
| 110 | + protected function process_post_type(Post_Type $post_type_registerable) { |
|
| 111 | 111 | // Register registerable. |
| 112 | 112 | $this->loader->action( |
| 113 | 113 | 'init', |
| 114 | - static function () use ( $post_type_registerable ) { |
|
| 114 | + static function() use ($post_type_registerable) { |
|
| 115 | 115 | Registrar_Factory::new() |
| 116 | - ->create_from_registerable( $post_type_registerable ) |
|
| 117 | - ->register( $post_type_registerable ); |
|
| 116 | + ->create_from_registerable($post_type_registerable) |
|
| 117 | + ->register($post_type_registerable); |
|
| 118 | 118 | } |
| 119 | 119 | ); |
| 120 | 120 | |
| 121 | 121 | // Define use of gutenberg |
| 122 | 122 | $this->loader->filter( |
| 123 | 123 | 'use_block_editor_for_post_type', |
| 124 | - static function ( bool $state, string $post_type ) use ( $post_type_registerable ): bool { |
|
| 124 | + static function(bool $state, string $post_type) use ($post_type_registerable): bool { |
|
| 125 | 125 | return $post_type === $post_type_registerable->key |
| 126 | 126 | ? (bool) $post_type_registerable->gutenberg |
| 127 | 127 | : $state; |
@@ -131,17 +131,17 @@ discard block |
||
| 131 | 131 | ); |
| 132 | 132 | |
| 133 | 133 | // Register meta boxes. |
| 134 | - $meta_boxes = $post_type_registerable->meta_boxes( array() ); |
|
| 134 | + $meta_boxes = $post_type_registerable->meta_boxes(array()); |
|
| 135 | 135 | |
| 136 | - if ( ! empty( $meta_boxes ) ) { |
|
| 136 | + if ( ! empty($meta_boxes)) { |
|
| 137 | 137 | |
| 138 | 138 | // Create the registrar |
| 139 | 139 | $meta_box_registrar = $this->get_meta_box_registrar(); |
| 140 | 140 | |
| 141 | 141 | // Register each meta box. |
| 142 | - foreach ( $meta_boxes as $meta_box ) { |
|
| 143 | - $meta_box->screen( $post_type_registerable->key ); |
|
| 144 | - $meta_box_registrar->register( $meta_box ); |
|
| 142 | + foreach ($meta_boxes as $meta_box) { |
|
| 143 | + $meta_box->screen($post_type_registerable->key); |
|
| 144 | + $meta_box_registrar->register($meta_box); |
|
| 145 | 145 | } |
| 146 | 146 | } |
| 147 | 147 | } |
@@ -154,12 +154,12 @@ discard block |
||
| 154 | 154 | * @return void |
| 155 | 155 | * @since 0.7.0 |
| 156 | 156 | */ |
| 157 | - public function process_shared_meta_box( Shared_Meta_Box_Controller $controller ): void { |
|
| 157 | + public function process_shared_meta_box(Shared_Meta_Box_Controller $controller): void { |
|
| 158 | 158 | $registrar = new Shared_Meta_Box_Registrar( |
| 159 | 159 | $this->get_meta_box_registrar(), |
| 160 | 160 | Registrar_Factory::new()->meta_data_registrar() |
| 161 | 161 | ); |
| 162 | - $registrar->register( $controller ); |
|
| 162 | + $registrar->register($controller); |
|
| 163 | 163 | } |
| 164 | 164 | |
| 165 | 165 | /** |
@@ -169,11 +169,11 @@ discard block |
||
| 169 | 169 | * @return void |
| 170 | 170 | * @since 0.8.0 |
| 171 | 171 | */ |
| 172 | - public function process_additional_meta_data( Additional_Meta_Data_Controller $controller ): void { |
|
| 172 | + public function process_additional_meta_data(Additional_Meta_Data_Controller $controller): void { |
|
| 173 | 173 | $registrar = new Additional_Meta_Data_Registrar( |
| 174 | 174 | Registrar_Factory::new()->meta_data_registrar() |
| 175 | 175 | ); |
| 176 | - $registrar->register( $controller ); |
|
| 176 | + $registrar->register($controller); |
|
| 177 | 177 | } |
| 178 | 178 | |
| 179 | 179 | /** |
@@ -183,7 +183,7 @@ discard block |
||
| 183 | 183 | * @since 0.7.0 |
| 184 | 184 | */ |
| 185 | 185 | public function get_meta_box_registrar(): Meta_Box_Registrar { |
| 186 | - return Registrar_Factory::new()->meta_box_registrar( $this->di_container, $this->loader ); |
|
| 186 | + return Registrar_Factory::new()->meta_box_registrar($this->di_container, $this->loader); |
|
| 187 | 187 | } |
| 188 | 188 | |
| 189 | 189 | public function setup(): void { |
@@ -45,7 +45,7 @@ |
||
| 45 | 45 | * @return Meta_Data[] |
| 46 | 46 | * @codeCoverageIgnore |
| 47 | 47 | */ |
| 48 | - public function meta_data( array $meta_data ): array { |
|
| 48 | + public function meta_data(array $meta_data): array { |
|
| 49 | 49 | return $meta_data; |
| 50 | 50 | } |
| 51 | 51 | } |
@@ -100,7 +100,7 @@ discard block |
||
| 100 | 100 | */ |
| 101 | 101 | protected string $meta_key; |
| 102 | 102 | |
| 103 | - public function __construct( string $meta_key ) { |
|
| 103 | + public function __construct(string $meta_key) { |
|
| 104 | 104 | $this->meta_key = $meta_key; |
| 105 | 105 | } |
| 106 | 106 | |
@@ -111,7 +111,7 @@ discard block |
||
| 111 | 111 | * @param string $meta_type Object type meta applies to |
| 112 | 112 | * @return self |
| 113 | 113 | */ |
| 114 | - public function meta_type( string $meta_type ): self { |
|
| 114 | + public function meta_type(string $meta_type): self { |
|
| 115 | 115 | $this->meta_type = $meta_type; |
| 116 | 116 | return $this; |
| 117 | 117 | } |
@@ -122,7 +122,7 @@ discard block |
||
| 122 | 122 | * @param string|null $object_subtype Holds a secondary object type, used for post type and taxonomy. |
| 123 | 123 | * @return self |
| 124 | 124 | */ |
| 125 | - public function object_subtype( ?string $object_subtype ): self { |
|
| 125 | + public function object_subtype(?string $object_subtype): self { |
|
| 126 | 126 | $this->object_subtype = $object_subtype ?? ''; |
| 127 | 127 | return $this; |
| 128 | 128 | } |
@@ -134,7 +134,7 @@ discard block |
||
| 134 | 134 | * @param string $type |
| 135 | 135 | * @return self |
| 136 | 136 | */ |
| 137 | - public function type( string $type ): self { |
|
| 137 | + public function type(string $type): self { |
|
| 138 | 138 | $this->type = $type; |
| 139 | 139 | return $this; |
| 140 | 140 | } |
@@ -145,9 +145,9 @@ discard block |
||
| 145 | 145 | * @param string $post_type |
| 146 | 146 | * @return self |
| 147 | 147 | */ |
| 148 | - public function post_type( string $post_type ): self { |
|
| 149 | - $this->meta_type( 'post' ); |
|
| 150 | - $this->object_subtype( $post_type ); |
|
| 148 | + public function post_type(string $post_type): self { |
|
| 149 | + $this->meta_type('post'); |
|
| 150 | + $this->object_subtype($post_type); |
|
| 151 | 151 | return $this; |
| 152 | 152 | } |
| 153 | 153 | |
@@ -157,9 +157,9 @@ discard block |
||
| 157 | 157 | * @param string $taxonomy |
| 158 | 158 | * @return self |
| 159 | 159 | */ |
| 160 | - public function taxonomy( string $taxonomy ): self { |
|
| 161 | - $this->meta_type( 'term' ); |
|
| 162 | - $this->object_subtype( $taxonomy ); |
|
| 160 | + public function taxonomy(string $taxonomy): self { |
|
| 161 | + $this->meta_type('term'); |
|
| 162 | + $this->object_subtype($taxonomy); |
|
| 163 | 163 | return $this; |
| 164 | 164 | } |
| 165 | 165 | |
@@ -170,7 +170,7 @@ discard block |
||
| 170 | 170 | * |
| 171 | 171 | * @return self |
| 172 | 172 | */ |
| 173 | - public function description( string $description ): self { |
|
| 173 | + public function description(string $description): self { |
|
| 174 | 174 | $this->description = $description; |
| 175 | 175 | return $this; |
| 176 | 176 | } |
@@ -181,7 +181,7 @@ discard block |
||
| 181 | 181 | * @param boolean $single Meta value is single value or array |
| 182 | 182 | * @return self |
| 183 | 183 | */ |
| 184 | - public function single( bool $single = true ): self { |
|
| 184 | + public function single(bool $single = true): self { |
|
| 185 | 185 | $this->single = $single; |
| 186 | 186 | return $this; |
| 187 | 187 | } |
@@ -192,7 +192,7 @@ discard block |
||
| 192 | 192 | * @param mixed $default_value |
| 193 | 193 | * @return self |
| 194 | 194 | */ |
| 195 | - public function default( $default_value ): self { |
|
| 195 | + public function default($default_value): self { |
|
| 196 | 196 | $this->default = $default_value; |
| 197 | 197 | return $this; |
| 198 | 198 | } |
@@ -203,7 +203,7 @@ discard block |
||
| 203 | 203 | * @param callable(mixed):mixed $callback |
| 204 | 204 | * @return self |
| 205 | 205 | */ |
| 206 | - public function sanitize( callable $callback ): self { |
|
| 206 | + public function sanitize(callable $callback): self { |
|
| 207 | 207 | $this->callbacks['sanitize'] = $callback; |
| 208 | 208 | return $this; |
| 209 | 209 | } |
@@ -214,7 +214,7 @@ discard block |
||
| 214 | 214 | * @param callable $callback |
| 215 | 215 | * @return self |
| 216 | 216 | */ |
| 217 | - public function permissions( callable $callback ): self { |
|
| 217 | + public function permissions(callable $callback): self { |
|
| 218 | 218 | $this->callbacks['permissions'] = $callback; |
| 219 | 219 | return $this; |
| 220 | 220 | } |
@@ -225,7 +225,7 @@ discard block |
||
| 225 | 225 | * @param boolean|array<mixed> $rest_schema|PinkCrab\WP_Rest_Schema\Argument\Argument Rest schema definitions |
| 226 | 226 | * @return self |
| 227 | 227 | */ |
| 228 | - public function rest_schema( $rest_schema ): self { |
|
| 228 | + public function rest_schema($rest_schema): self { |
|
| 229 | 229 | $this->rest_schema = $rest_schema; |
| 230 | 230 | return $this; |
| 231 | 231 | } |
@@ -236,7 +236,7 @@ discard block |
||
| 236 | 236 | * @param callable|null $callback |
| 237 | 237 | * @return self |
| 238 | 238 | */ |
| 239 | - public function rest_view( ?callable $callback ): self { |
|
| 239 | + public function rest_view(?callable $callback): self { |
|
| 240 | 240 | $this->callbacks['rest_view'] = $callback; |
| 241 | 241 | return $this; |
| 242 | 242 | } |
@@ -247,7 +247,7 @@ discard block |
||
| 247 | 247 | * @param null|callable(mixed,\WP_Post|\WP_Term|\WP_User|\WP_Comment):void $callback |
| 248 | 248 | * @return self |
| 249 | 249 | */ |
| 250 | - public function rest_update( ?callable $callback ): self { |
|
| 250 | + public function rest_update(?callable $callback): self { |
|
| 251 | 251 | $this->callbacks['rest_update'] = $callback; |
| 252 | 252 | return $this; |
| 253 | 253 | } |
@@ -269,7 +269,7 @@ discard block |
||
| 269 | 269 | ); |
| 270 | 270 | |
| 271 | 271 | // Set subtype. |
| 272 | - if ( $this->object_subtype !== null ) { |
|
| 272 | + if ($this->object_subtype !== null) { |
|
| 273 | 273 | $args['object_subtype'] = $this->object_subtype; |
| 274 | 274 | } |
| 275 | 275 | return $args; |
@@ -53,7 +53,7 @@ |
||
| 53 | 53 | */ |
| 54 | 54 | public function register( Registerable $registerable ): void { |
| 55 | 55 | /** |
| 56 | - * @var Taxonomy $registerable, Validation call below catches no Post_Type Registerables |
|
| 56 | + * @var Taxonomy $registerable, Validation call below catches no Post_Type Registerables |
|
| 57 | 57 | */ |
| 58 | 58 | |
| 59 | 59 | if ( ! $this->validator->validate( $registerable ) ) { |
@@ -51,17 +51,17 @@ discard block |
||
| 51 | 51 | * @param \PinkCrab\Registerables\Module\Middleware\Registerable $registerable |
| 52 | 52 | * @return void |
| 53 | 53 | */ |
| 54 | - public function register( Registerable $registerable ): void { |
|
| 54 | + public function register(Registerable $registerable): void { |
|
| 55 | 55 | /** |
| 56 | 56 | * @var Taxonomy $registerable, Validation call below catches no Post_Type Registerables |
| 57 | 57 | */ |
| 58 | 58 | |
| 59 | - if ( ! $this->validator->validate( $registerable ) ) { |
|
| 59 | + if ( ! $this->validator->validate($registerable)) { |
|
| 60 | 60 | throw new Exception( |
| 61 | 61 | sprintf( |
| 62 | 62 | 'Failed validating taxonomy model(%s) with errors: %s', |
| 63 | - esc_html( get_class( $registerable ) ), |
|
| 64 | - esc_html( join( ', ', $this->validator->get_errors() ) ) |
|
| 63 | + esc_html(get_class($registerable)), |
|
| 64 | + esc_html(join(', ', $this->validator->get_errors())) |
|
| 65 | 65 | ) |
| 66 | 66 | ); |
| 67 | 67 | } |
@@ -72,18 +72,18 @@ discard block |
||
| 72 | 72 | $registerable->slug, |
| 73 | 73 | $registerable->object_type, |
| 74 | 74 | /* @phpstan-ignore-next-line */ |
| 75 | - $this->compile_args( $registerable ) |
|
| 75 | + $this->compile_args($registerable) |
|
| 76 | 76 | ); |
| 77 | 77 | |
| 78 | - if ( is_a( $result, \WP_Error::class ) ) { |
|
| 79 | - throw new Exception( join( $result->get_error_messages() ) ); |
|
| 78 | + if (is_a($result, \WP_Error::class)) { |
|
| 79 | + throw new Exception(join($result->get_error_messages())); |
|
| 80 | 80 | } |
| 81 | - } catch ( \Throwable $th ) { |
|
| 82 | - throw new Exception( esc_html( "Failed to register {$registerable->slug} taxonomy ({$th->getMessage()})" ) ); |
|
| 81 | + } catch (\Throwable $th) { |
|
| 82 | + throw new Exception(esc_html("Failed to register {$registerable->slug} taxonomy ({$th->getMessage()})")); |
|
| 83 | 83 | } |
| 84 | 84 | |
| 85 | 85 | // Register any associated meta data. |
| 86 | - $this->register_meta_data( $registerable ); |
|
| 86 | + $this->register_meta_data($registerable); |
|
| 87 | 87 | } |
| 88 | 88 | |
| 89 | 89 | /** |
@@ -92,18 +92,18 @@ discard block |
||
| 92 | 92 | * @param \PinkCrab\Registerables\Taxonomy $taxonomy |
| 93 | 93 | * @return void |
| 94 | 94 | */ |
| 95 | - protected function register_meta_data( Taxonomy $taxonomy ): void { |
|
| 95 | + protected function register_meta_data(Taxonomy $taxonomy): void { |
|
| 96 | 96 | |
| 97 | 97 | // Get all meta fields for taxonomy. |
| 98 | - $meta_fields = $taxonomy->meta_data( array() ); |
|
| 98 | + $meta_fields = $taxonomy->meta_data(array()); |
|
| 99 | 99 | |
| 100 | 100 | // Attempt to register all Meta for taxonomy. |
| 101 | 101 | try { |
| 102 | - foreach ( $meta_fields as $meta_field ) { |
|
| 103 | - $this->meta_data_registrar->register_for_term( $meta_field, $taxonomy->slug ); |
|
| 102 | + foreach ($meta_fields as $meta_field) { |
|
| 103 | + $this->meta_data_registrar->register_for_term($meta_field, $taxonomy->slug); |
|
| 104 | 104 | } |
| 105 | - } catch ( \Throwable $th ) { |
|
| 106 | - throw new Exception( esc_html( $th->getMessage() ) ); |
|
| 105 | + } catch (\Throwable $th) { |
|
| 106 | + throw new Exception(esc_html($th->getMessage())); |
|
| 107 | 107 | } |
| 108 | 108 | } |
| 109 | 109 | |
@@ -113,59 +113,59 @@ discard block |
||
| 113 | 113 | * @param \PinkCrab\Registerables\Taxonomy $taxonomy |
| 114 | 114 | * @return array<string, string|int|array<string, string>> |
| 115 | 115 | */ |
| 116 | - protected function compile_args( Taxonomy $taxonomy ): array { |
|
| 116 | + protected function compile_args(Taxonomy $taxonomy): array { |
|
| 117 | 117 | // Create the labels. |
| 118 | 118 | $base_labels = array( |
| 119 | 119 | 'name' => $taxonomy->plural, |
| 120 | 120 | 'singular_name' => $taxonomy->singular, |
| 121 | - 'menu_name' => \ucfirst( \esc_attr( $taxonomy->plural ?? '' ) ), |
|
| 121 | + 'menu_name' => \ucfirst(\esc_attr($taxonomy->plural ?? '')), |
|
| 122 | 122 | /* translators: %s: Taxonomy plural name */ |
| 123 | - 'search_items' => wp_sprintf( _x( 'Search %s', 'Label for searching plural items. Default is ‘Search {taxonomy plural name}’.', 'pinkcrab' ), \esc_attr( $taxonomy->plural ?? '' ) ), |
|
| 123 | + 'search_items' => wp_sprintf(_x('Search %s', 'Label for searching plural items. Default is ‘Search {taxonomy plural name}’.', 'pinkcrab'), \esc_attr($taxonomy->plural ?? '')), |
|
| 124 | 124 | /* translators: %s: Taxonomy plural name */ |
| 125 | - 'popular_items' => wp_sprintf( _x( 'Popular %s', 'Label for the popular terms', 'pinkcrab' ), \esc_attr( $taxonomy->plural ?? '' ) ), |
|
| 125 | + 'popular_items' => wp_sprintf(_x('Popular %s', 'Label for the popular terms', 'pinkcrab'), \esc_attr($taxonomy->plural ?? '')), |
|
| 126 | 126 | /* translators: %s: Taxonomy singular name */ |
| 127 | - 'edit_item' => wp_sprintf( _x( 'Edit %s', 'Label for editing a singular item. Default is ‘Edit {taxonomy singular name}’.', 'pinkcrab' ), \esc_attr( $taxonomy->singular ?? '' ) ), |
|
| 127 | + 'edit_item' => wp_sprintf(_x('Edit %s', 'Label for editing a singular item. Default is ‘Edit {taxonomy singular name}’.', 'pinkcrab'), \esc_attr($taxonomy->singular ?? '')), |
|
| 128 | 128 | /* translators: %s: Taxonomy singular name */ |
| 129 | - 'view_item' => wp_sprintf( _x( 'View %s', 'Label for viewing a singular item. Default is ‘View {taxonomy singular name}’.', 'pinkcrab' ), \esc_attr( $taxonomy->singular ?? '' ) ), |
|
| 129 | + 'view_item' => wp_sprintf(_x('View %s', 'Label for viewing a singular item. Default is ‘View {taxonomy singular name}’.', 'pinkcrab'), \esc_attr($taxonomy->singular ?? '')), |
|
| 130 | 130 | /* translators: %s: Taxonomy singular name */ |
| 131 | - 'update_item' => wp_sprintf( _x( 'Update %s', 'Label for editing a singular item. Default is ‘Edit {taxonomy singular name}’.', 'pinkcrab' ), \esc_attr( $taxonomy->singular ?? '' ) ), |
|
| 131 | + 'update_item' => wp_sprintf(_x('Update %s', 'Label for editing a singular item. Default is ‘Edit {taxonomy singular name}’.', 'pinkcrab'), \esc_attr($taxonomy->singular ?? '')), |
|
| 132 | 132 | /* translators: %s: Taxonomy singular name */ |
| 133 | - 'add_new_item' => wp_sprintf( _x( 'Add New %s', 'Label for adding a new singular item. Default is ‘Add New {taxonomy singular name}’.', 'pinkcrab' ), \esc_attr( $taxonomy->singular ?? '' ) ), |
|
| 133 | + 'add_new_item' => wp_sprintf(_x('Add New %s', 'Label for adding a new singular item. Default is ‘Add New {taxonomy singular name}’.', 'pinkcrab'), \esc_attr($taxonomy->singular ?? '')), |
|
| 134 | 134 | /* translators: %s: Taxonomy singular name */ |
| 135 | - 'new_item_name' => wp_sprintf( _x( 'New %s', 'Label for the new item page title. Default is ‘New {taxonomy singular name}’.', 'pinkcrab' ), \esc_attr( $taxonomy->singular ?? '' ) ), |
|
| 135 | + 'new_item_name' => wp_sprintf(_x('New %s', 'Label for the new item page title. Default is ‘New {taxonomy singular name}’.', 'pinkcrab'), \esc_attr($taxonomy->singular ?? '')), |
|
| 136 | 136 | /* translators: %s: Taxonomy plural name */ |
| 137 | - 'not_found' => wp_sprintf( _x( 'No %s found', 'Label used when no items are found. Default is ‘No {taxonomy plural name} found’.', 'pinkcrab' ), \esc_attr( $taxonomy->plural ?? '' ) ), |
|
| 137 | + 'not_found' => wp_sprintf(_x('No %s found', 'Label used when no items are found. Default is ‘No {taxonomy plural name} found’.', 'pinkcrab'), \esc_attr($taxonomy->plural ?? '')), |
|
| 138 | 138 | /* translators: %s: Taxonomy plural name */ |
| 139 | - 'items_list' => wp_sprintf( _x( '%s list', 'Label for the table hidden heading. Default is ‘{taxonomy plural name} list’.', 'pinkcrab' ), \ucfirst( \esc_attr( $taxonomy->plural ?? '' ) ) ), |
|
| 139 | + 'items_list' => wp_sprintf(_x('%s list', 'Label for the table hidden heading. Default is ‘{taxonomy plural name} list’.', 'pinkcrab'), \ucfirst(\esc_attr($taxonomy->plural ?? ''))), |
|
| 140 | 140 | /* translators: %s: Taxonomy plural name */ |
| 141 | - 'items_list_navigation' => wp_sprintf( _x( '%s list navigation', 'Label for the pagination hidden heading. Default is ‘{taxonomy plural name} list’.', 'pinkcrab' ), \ucfirst( \esc_attr( $taxonomy->plural ?? '' ) ) ), |
|
| 141 | + 'items_list_navigation' => wp_sprintf(_x('%s list navigation', 'Label for the pagination hidden heading. Default is ‘{taxonomy plural name} list’.', 'pinkcrab'), \ucfirst(\esc_attr($taxonomy->plural ?? ''))), |
|
| 142 | 142 | /* translators: %s: Taxonomy plural name */ |
| 143 | - 'all_items' => wp_sprintf( _x( 'All %s', 'Label for the pagination hidden heading. Default is ‘{taxonomy plural name} list’.', 'pinkcrab' ), \ucfirst( \esc_attr( $taxonomy->plural ?? '' ) ) ), |
|
| 144 | - 'most_used' => _x( 'Most Used', 'Title for the Most Used tab. Default \'Most Used\'.', 'pinkcrab' ), |
|
| 143 | + 'all_items' => wp_sprintf(_x('All %s', 'Label for the pagination hidden heading. Default is ‘{taxonomy plural name} list’.', 'pinkcrab'), \ucfirst(\esc_attr($taxonomy->plural ?? ''))), |
|
| 144 | + 'most_used' => _x('Most Used', 'Title for the Most Used tab. Default \'Most Used\'.', 'pinkcrab'), |
|
| 145 | 145 | /* translators: %s: Taxonomy plural name */ |
| 146 | - 'back_to_items' => wp_sprintf( _x( '← Back to %s', 'Label for the pagination hidden heading. Default is ‘{taxonomy plural name} list’.', 'pinkcrab' ), \ucfirst( \esc_attr( $taxonomy->plural ?? '' ) ) ), |
|
| 146 | + 'back_to_items' => wp_sprintf(_x('← Back to %s', 'Label for the pagination hidden heading. Default is ‘{taxonomy plural name} list’.', 'pinkcrab'), \ucfirst(\esc_attr($taxonomy->plural ?? ''))), |
|
| 147 | 147 | /* translators: %s: Taxonomy singular name */ |
| 148 | - 'item_link' => wp_sprintf( _x( '%s Link', 'Title for a navigation link block variation. Default is ‘{taxonomy singular name} Link’.', 'pinkcrab' ), \ucfirst( \esc_attr( $taxonomy->singular ?? '' ) ) ), |
|
| 148 | + 'item_link' => wp_sprintf(_x('%s Link', 'Title for a navigation link block variation. Default is ‘{taxonomy singular name} Link’.', 'pinkcrab'), \ucfirst(\esc_attr($taxonomy->singular ?? ''))), |
|
| 149 | 149 | /* translators: %s: Taxonomy singular name */ |
| 150 | - 'item_link_description' => wp_sprintf( _x( 'A link to a %s', 'Description for a navigation link block variation. Default is ‘A link to a {taxonomy singular name}’.', 'pinkcrab' ), \esc_attr( $taxonomy->singular ?? '' ) ), |
|
| 150 | + 'item_link_description' => wp_sprintf(_x('A link to a %s', 'Description for a navigation link block variation. Default is ‘A link to a {taxonomy singular name}’.', 'pinkcrab'), \esc_attr($taxonomy->singular ?? '')), |
|
| 151 | 151 | ); |
| 152 | 152 | |
| 153 | 153 | $tag_labels = array( |
| 154 | 154 | /* translators: %s: Taxonomy plural name */ |
| 155 | - 'separate_items_with_commas' => wp_sprintf( _x( 'Separate %s with commas', 'This label is only used for non-hierarchical taxonomies. Default \'Separate {taxonomy plural name} with commas\', used in the meta box.’.', 'pinkcrab' ), \esc_attr( $taxonomy->plural ?? '' ) ), |
|
| 155 | + 'separate_items_with_commas' => wp_sprintf(_x('Separate %s with commas', 'This label is only used for non-hierarchical taxonomies. Default \'Separate {taxonomy plural name} with commas\', used in the meta box.’.', 'pinkcrab'), \esc_attr($taxonomy->plural ?? '')), |
|
| 156 | 156 | /* translators: %s: Taxonomy plural name */ |
| 157 | - 'add_or_remove_items' => wp_sprintf( _x( 'Add or remove %s', 'This label is only used for non-hierarchical taxonomies. Default \'Add or remove {taxonomy plural name}\', used in the meta box when JavaScript is disabled.', 'pinkcrab' ), \esc_attr( $taxonomy->plural ?? '' ) ), |
|
| 157 | + 'add_or_remove_items' => wp_sprintf(_x('Add or remove %s', 'This label is only used for non-hierarchical taxonomies. Default \'Add or remove {taxonomy plural name}\', used in the meta box when JavaScript is disabled.', 'pinkcrab'), \esc_attr($taxonomy->plural ?? '')), |
|
| 158 | 158 | /* translators: %s: Taxonomy plural name */ |
| 159 | - 'choose_from_most_used' => wp_sprintf( _x( 'Add or remove %s', 'This label is only used on non-hierarchical taxonomies. Default\'Choose from the most used {taxonomy plural name}\', used in the meta box.', 'pinkcrab' ), \esc_attr( $taxonomy->plural ?? '' ) ), |
|
| 159 | + 'choose_from_most_used' => wp_sprintf(_x('Add or remove %s', 'This label is only used on non-hierarchical taxonomies. Default\'Choose from the most used {taxonomy plural name}\', used in the meta box.', 'pinkcrab'), \esc_attr($taxonomy->plural ?? '')), |
|
| 160 | 160 | ); |
| 161 | 161 | |
| 162 | 162 | $hierarchical_labels = array( |
| 163 | 163 | /* translators: %s: Taxonomy singular name */ |
| 164 | - 'parent_item_colon' => wp_sprintf( _x( 'Parent %s:', 'Label used to prefix parents of hierarchical items. Not used on non-hierarchical taxonomys. Default is ‘Parent {taxonomy plural name}:’.', 'pinkcrab' ), \esc_attr( $taxonomy->singular ?? '' ) ), |
|
| 164 | + 'parent_item_colon' => wp_sprintf(_x('Parent %s:', 'Label used to prefix parents of hierarchical items. Not used on non-hierarchical taxonomys. Default is ‘Parent {taxonomy plural name}:’.', 'pinkcrab'), \esc_attr($taxonomy->singular ?? '')), |
|
| 165 | 165 | /* translators: %s: Taxonomy singular name */ |
| 166 | - 'parent_item' => wp_sprintf( _x( 'Parent %s', 'Label for the parent term', 'pinkcrab' ), \esc_attr( $taxonomy->singular ?? '' ) ), |
|
| 166 | + 'parent_item' => wp_sprintf(_x('Parent %s', 'Label for the parent term', 'pinkcrab'), \esc_attr($taxonomy->singular ?? '')), |
|
| 167 | 167 | /* translators: %s: Taxonomy singular name */ |
| 168 | - 'filter_by_item' => wp_sprintf( _x( 'Filter by %s', 'This label is only used for hierarchical taxonomies. Default \'Filter by {taxonomy singular name}\', used in the posts list table.', 'pinkcrab' ), \esc_attr( $taxonomy->singular ?? '' ) ), |
|
| 168 | + 'filter_by_item' => wp_sprintf(_x('Filter by %s', 'This label is only used for hierarchical taxonomies. Default \'Filter by {taxonomy singular name}\', used in the posts list table.', 'pinkcrab'), \esc_attr($taxonomy->singular ?? '')), |
|
| 169 | 169 | ); |
| 170 | 170 | |
| 171 | 171 | $labels = array_merge( |
@@ -181,7 +181,7 @@ discard block |
||
| 181 | 181 | * @param Taxonomy $taxonomy |
| 182 | 182 | * @return array<string, string> |
| 183 | 183 | */ |
| 184 | - $labels = apply_filters( Registerable_Hooks::TAXONOMY_LABELS, $taxonomy->filter_labels( $labels ), $taxonomy ); |
|
| 184 | + $labels = apply_filters(Registerable_Hooks::TAXONOMY_LABELS, $taxonomy->filter_labels($labels), $taxonomy); |
|
| 185 | 185 | |
| 186 | 186 | // Compose args. |
| 187 | 187 | $args = array( |
@@ -228,6 +228,6 @@ discard block |
||
| 228 | 228 | * @return array<string, string|bool|int|null|array<string, string>> |
| 229 | 229 | */ |
| 230 | 230 | /* @phpstan-ignore-next-line, this is due to apply_filters type hints being wrong. */ |
| 231 | - return apply_filters( Registerable_Hooks::TAXONOMY_ARGS, $taxonomy->filter_args( $args ), $taxonomy ); |
|
| 231 | + return apply_filters(Registerable_Hooks::TAXONOMY_ARGS, $taxonomy->filter_args($args), $taxonomy); |
|
| 232 | 232 | } |
| 233 | 233 | } |