@@ -22,9 +22,12 @@ discard block |
||
| 22 | 22 | */ |
| 23 | 23 | protected function addInstructions() |
| 24 | 24 | { |
| 25 | - if( !count( array_filter( $this->metaboxes, function( $metabox ) { |
|
| 25 | + if( !count( array_filter( $this->metaboxes, function( $metabox ) |
|
| 26 | + { |
|
| 26 | 27 | return $this->show( false, $metabox ); |
| 27 | - })))return; |
|
| 28 | + }))) { |
|
| 29 | + return; |
|
| 30 | + } |
|
| 28 | 31 | $this->metaboxes[] = [ |
| 29 | 32 | 'id' => 'infodiv', |
| 30 | 33 | 'post_types' => $this->getPostTypes(), |
@@ -44,8 +47,10 @@ discard block |
||
| 44 | 47 | */ |
| 45 | 48 | protected function generateInstructions() |
| 46 | 49 | { |
| 47 | - return array_reduce( $this->getInstructions(), function( $html, $metabox ) { |
|
| 48 | - $fields = array_reduce( array_column( $metabox['fields'], 'slug' ), function( $html, $slug ) use( $metabox ) { |
|
| 50 | + return array_reduce( $this->getInstructions(), function( $html, $metabox ) |
|
| 51 | + { |
|
| 52 | + $fields = array_reduce( array_column( $metabox['fields'], 'slug' ), function( $html, $slug ) use( $metabox ) |
|
| 53 | + { |
|
| 49 | 54 | $hook = sprintf( 'pollux/%s/instruction', strtolower(( new Helper )->getClassname( $this ))); |
| 50 | 55 | error_log( print_r( $hook, 1 )); |
| 51 | 56 | return $html . apply_filters( $hook, "PostMeta::get('{$slug}');", $slug, $metabox['slug'] ) . PHP_EOL; |
@@ -62,7 +67,8 @@ discard block |
||
| 62 | 67 | */ |
| 63 | 68 | protected function getInstructions() |
| 64 | 69 | { |
| 65 | - return array_filter( $this->metaboxes, function( $metabox ) { |
|
| 70 | + return array_filter( $this->metaboxes, function( $metabox ) |
|
| 71 | + { |
|
| 66 | 72 | return $this->validate( $metabox['condition'] ) |
| 67 | 73 | && $this->hasPostType( $metabox ); |
| 68 | 74 | }); |