@@ -86,6 +86,7 @@ |
||
| 86 | 86 | abstract public function filter( $name, ...$args ); |
| 87 | 87 | |
| 88 | 88 | /** |
| 89 | + * @param boolean $bool |
|
| 89 | 90 | * @return bool |
| 90 | 91 | * @filter rwmb_show |
| 91 | 92 | */ |
@@ -20,7 +20,8 @@ discard block |
||
| 20 | 20 | */ |
| 21 | 21 | protected function generateInstructions() |
| 22 | 22 | { |
| 23 | - $instructions = array_reduce( $this->getInstructionGroups(), function( $html, $metabox ) { |
|
| 23 | + $instructions = array_reduce( $this->getInstructionGroups(), function( $html, $metabox ) |
|
| 24 | + { |
|
| 24 | 25 | $fields = $this->getInstructionFields( $metabox ); |
| 25 | 26 | if( empty( $fields )) { |
| 26 | 27 | return $html; |
@@ -39,7 +40,8 @@ discard block |
||
| 39 | 40 | protected function getInstructionFields( $metabox ) |
| 40 | 41 | { |
| 41 | 42 | $skipFields = ['custom_html', 'divider', 'heading']; |
| 42 | - return array_reduce( $metabox['fields'], function( $html, $field ) use( $metabox ) { |
|
| 43 | + return array_reduce( $metabox['fields'], function( $html, $field ) use( $metabox ) |
|
| 44 | + { |
|
| 43 | 45 | return $this->validate( $field['condition'] ) && !in_array( $field['type'], $skipFields ) |
| 44 | 46 | ? $html . $this->filter( 'instruction', "PostMeta::get('{$field['slug']}');", $field, $metabox ) . PHP_EOL |
| 45 | 47 | : $html; |
@@ -51,7 +53,8 @@ discard block |
||
| 51 | 53 | */ |
| 52 | 54 | protected function getInstructionGroups() |
| 53 | 55 | { |
| 54 | - return array_filter( $this->metaboxes, function( $metabox ) { |
|
| 56 | + return array_filter( $this->metaboxes, function( $metabox ) |
|
| 57 | + { |
|
| 55 | 58 | return $this->validate( $metabox['condition'] ) |
| 56 | 59 | && $this->hasPostType( $metabox ); |
| 57 | 60 | }); |
@@ -62,7 +65,9 @@ discard block |
||
| 62 | 65 | */ |
| 63 | 66 | protected function initInstructions() |
| 64 | 67 | { |
| 65 | - if( !$this->showInstructions() )return; |
|
| 68 | + if( !$this->showInstructions() ) { |
|
| 69 | + return; |
|
| 70 | + } |
|
| 66 | 71 | return [ |
| 67 | 72 | 'infodiv' => [ |
| 68 | 73 | 'context' => 'side', |
@@ -83,7 +88,8 @@ discard block |
||
| 83 | 88 | */ |
| 84 | 89 | protected function showInstructions() |
| 85 | 90 | { |
| 86 | - return $this->filter( 'show/instructions', count( array_filter( $this->metaboxes, function( $metabox ) { |
|
| 91 | + return $this->filter( 'show/instructions', count( array_filter( $this->metaboxes, function( $metabox ) |
|
| 92 | + { |
|
| 87 | 93 | return $this->show( false, $metabox ); |
| 88 | 94 | })) > 0 ); |
| 89 | 95 | } |