|
1 | 1 | <?php |
2 | 2 | /** |
3 | | - * @version 1.6.6 |
| 3 | + * @version 1.6.11 |
4 | 4 | * @author Technote |
5 | 5 | * @since 1.4.0 |
6 | 6 | * @since 1.5.0 Changed: ライブラリの変更 (#37) |
7 | 7 | * @since 1.6.0 Changed: Gutenbergへの対応 (#3) |
8 | 8 | * @since 1.6.6 Changed: フレームワークの更新 (#76) |
| 9 | + * @since 1.6.11 #85 |
9 | 10 | * @copyright Technote All Rights Reserved |
10 | 11 | * @license http://www.opensource.org/licenses/gpl-2.0.php GNU General Public License, version 2 |
11 | 12 | * @link https://technote.space/ |
@@ -86,6 +87,9 @@ protected function filter_edit_form_params( |
86 | 87 | $params['columns']['function']['form_type'] = 'select'; |
87 | 88 | $params['columns']['function']['options'] = $assets->get_animation_functions(); |
88 | 89 | $params['name_prefix'] = $assets->get_name_prefix(); |
| 90 | + if ( ! $this->app->utility->can_use_block_editor() ) { |
| 91 | + unset( $params['columns']['is_valid_button_block_editor'] ); |
| 92 | + } |
89 | 93 |
|
90 | 94 | return $params; |
91 | 95 | } |
@@ -184,14 +188,19 @@ protected function get_manage_posts_columns() { |
184 | 188 | /** @noinspection PhpUnusedParameterInspection */ |
185 | 189 | $value, $data, $post |
186 | 190 | ) { |
| 191 | + $details = [ |
| 192 | + 'repeat' => empty( $data['repeat'] ) ? $this->translate( 'No' ) : $this->translate( 'Yes' ), |
| 193 | + 'is valid button' => empty( $data['is_valid_button'] ) ? $this->translate( 'No' ) : $this->translate( 'Yes' ), |
| 194 | + 'is valid style' => empty( $data['is_valid_style'] ) ? $this->translate( 'No' ) : $this->translate( 'Yes' ), |
| 195 | + 'is valid block editor button' => empty( $data['is_valid_button_block_editor'] ) ? $this->translate( 'No' ) : $this->translate( 'Yes' ), |
| 196 | + 'selector' => $this->get_default_class( $post->ID ) . ( empty( $data['selector'] ) ? '' : ', ' . $data['selector'] ), |
| 197 | + ]; |
| 198 | + if ( ! $this->app->utility->can_use_block_editor() ) { |
| 199 | + unset( $details['is valid block editor button'] ); |
| 200 | + } |
| 201 | + |
187 | 202 | return $this->get_view( 'admin/custom_post/setting/others', [ |
188 | | - 'details' => [ |
189 | | - 'repeat' => empty( $data['repeat'] ) ? $this->translate( 'No' ) : $this->translate( 'Yes' ), |
190 | | - 'is valid button' => empty( $data['is_valid_button'] ) ? $this->translate( 'No' ) : $this->translate( 'Yes' ), |
191 | | - 'is valid style' => empty( $data['is_valid_style'] ) ? $this->translate( 'No' ) : $this->translate( 'Yes' ), |
192 | | - 'is valid block editor button' => empty( $data['is_valid_button_block_editor'] ) ? $this->translate( 'No' ) : $this->translate( 'Yes' ), |
193 | | - 'selector' => $this->get_default_class( $post->ID ) . ( empty( $data['selector'] ) ? '' : ', ' . $data['selector'] ), |
194 | | - ], |
| 203 | + 'details' => $details, |
195 | 204 | ] ); |
196 | 205 | }, |
197 | 206 | 'unescape' => true, |
@@ -276,6 +285,27 @@ private function clear_options_cache() { |
276 | 285 | $assets->clear_options_cache(); |
277 | 286 | } |
278 | 287 |
|
| 288 | + /** |
| 289 | + * @param string $key |
| 290 | + * @param mixed $value |
| 291 | + * @param mixed $default |
| 292 | + * @param array|null $post_array |
| 293 | + * |
| 294 | + * @return mixed |
| 295 | + */ |
| 296 | + protected function filter_post_field( |
| 297 | + /** @noinspection PhpUnusedParameterInspection */ |
| 298 | + $key, $value, $default, $post_array |
| 299 | + ) { |
| 300 | + if ( 'is_valid_button_block_editor' === $key ) { |
| 301 | + if ( ! $this->app->utility->can_use_block_editor() ) { |
| 302 | + return $this->app->input->post( $this->get_post_field_name( 'is_valid_button' ) ); |
| 303 | + } |
| 304 | + } |
| 305 | + |
| 306 | + return $value; |
| 307 | + } |
| 308 | + |
279 | 309 | /** |
280 | 310 | * @since 1.6.0 #3 |
281 | 311 | * |
|
0 commit comments