Skip to content
This repository was archived by the owner on Aug 1, 2021. It is now read-only.

Commit d3237cc

Browse files
1 parent cde8801 commit d3237cc

File tree

1 file changed

+34
-7
lines changed

1 file changed

+34
-7
lines changed

src/classes/models/custom_post/setting.php

Lines changed: 34 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -86,6 +86,9 @@ protected function filter_edit_form_params(
8686
$params['columns']['function']['form_type'] = 'select';
8787
$params['columns']['function']['options'] = $assets->get_animation_functions();
8888
$params['name_prefix'] = $assets->get_name_prefix();
89+
if ( ! $this->app->utility->can_use_block_editor() ) {
90+
unset( $params['columns']['is_valid_button_block_editor'] );
91+
}
8992

9093
return $params;
9194
}
@@ -184,14 +187,19 @@ protected function get_manage_posts_columns() {
184187
/** @noinspection PhpUnusedParameterInspection */
185188
$value, $data, $post
186189
) {
190+
$details = [
191+
'repeat' => empty( $data['repeat'] ) ? $this->translate( 'No' ) : $this->translate( 'Yes' ),
192+
'is valid button' => empty( $data['is_valid_button'] ) ? $this->translate( 'No' ) : $this->translate( 'Yes' ),
193+
'is valid style' => empty( $data['is_valid_style'] ) ? $this->translate( 'No' ) : $this->translate( 'Yes' ),
194+
'is valid block editor button' => empty( $data['is_valid_button_block_editor'] ) ? $this->translate( 'No' ) : $this->translate( 'Yes' ),
195+
'selector' => $this->get_default_class( $post->ID ) . ( empty( $data['selector'] ) ? '' : ', ' . $data['selector'] ),
196+
];
197+
if ( ! $this->app->utility->can_use_block_editor() ) {
198+
unset( $details['is valid block editor button'] );
199+
}
200+
187201
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-
],
202+
'details' => $details,
195203
] );
196204
},
197205
'unescape' => true,
@@ -276,6 +284,25 @@ private function clear_options_cache() {
276284
$assets->clear_options_cache();
277285
}
278286

287+
/**
288+
* @param string $key
289+
* @param mixed $value
290+
* @param mixed $default
291+
* @param array|null $post_array
292+
*
293+
* @return mixed
294+
*/
295+
protected function filter_post_field(
296+
/** @noinspection PhpUnusedParameterInspection */
297+
$key, $value, $default, $post_array
298+
) {
299+
if ( 'is_valid_button_block_editor' === $key ) {
300+
return $this->app->input->post( $this->get_post_field_name( 'is_valid_button' ) );
301+
}
302+
303+
return $value;
304+
}
305+
279306
/**
280307
* @since 1.6.0 #3
281308
*

0 commit comments

Comments
 (0)