@@ -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; |
@@ -38,7 +39,8 @@ discard block |
||
| 38 | 39 | */ |
| 39 | 40 | protected function getInstructionFields( $metabox ) |
| 40 | 41 | { |
| 41 | - return array_reduce( $metabox['fields'], function( $html, $field ) use( $metabox ) { |
|
| 42 | + return array_reduce( $metabox['fields'], function( $html, $field ) use( $metabox ) |
|
| 43 | + { |
|
| 42 | 44 | return $this->validate( $field['condition'] ) && !in_array( $field['type'], ['divider', 'heading'] ) |
| 43 | 45 | ? $html . $this->filter( 'instruction', "PostMeta::get('{$field['slug']}');", $field, $metabox ) . PHP_EOL |
| 44 | 46 | : $html; |
@@ -50,7 +52,8 @@ discard block |
||
| 50 | 52 | */ |
| 51 | 53 | protected function getInstructionGroups() |
| 52 | 54 | { |
| 53 | - return array_filter( $this->metaboxes, function( $metabox ) { |
|
| 55 | + return array_filter( $this->metaboxes, function( $metabox ) |
|
| 56 | + { |
|
| 54 | 57 | return $this->validate( $metabox['condition'] ) |
| 55 | 58 | && $this->hasPostType( $metabox ); |
| 56 | 59 | }); |
@@ -61,7 +64,9 @@ discard block |
||
| 61 | 64 | */ |
| 62 | 65 | protected function initInstructions() |
| 63 | 66 | { |
| 64 | - if( !$this->showInstructions() )return; |
|
| 67 | + if( !$this->showInstructions() ) { |
|
| 68 | + return; |
|
| 69 | + } |
|
| 65 | 70 | return [ |
| 66 | 71 | 'infodiv' => [ |
| 67 | 72 | 'context' => 'side', |
@@ -82,7 +87,8 @@ discard block |
||
| 82 | 87 | */ |
| 83 | 88 | protected function showInstructions() |
| 84 | 89 | { |
| 85 | - return $this->filter( 'show/instructions', count( array_filter( $this->metaboxes, function( $metabox ) { |
|
| 90 | + return $this->filter( 'show/instructions', count( array_filter( $this->metaboxes, function( $metabox ) |
|
| 91 | + { |
|
| 86 | 92 | return $this->show( false, $metabox ); |
| 87 | 93 | })) > 0 ); |
| 88 | 94 | } |