Skip to content

Commit

Permalink
Fix a type error where the component returned is not an array
Browse files Browse the repository at this point in the history
  • Loading branch information
srtfisher committed Mar 14, 2024
1 parent 8e94a3f commit d755ca5
Showing 1 changed file with 8 additions and 5 deletions.
13 changes: 8 additions & 5 deletions includes/apple-exporter/builders/class-components.php
Original file line number Diff line number Diff line change
Expand Up @@ -864,14 +864,17 @@ private function meta_components() {
if ( ! ( $component instanceof Component ) ) {
continue;
}

$component = $component->to_array();

// If the cover isn't first, give it a different layout.
if ( 'header' === $component['role'] && 0 !== $i ) {
$component['layout'] = 'headerBelowTextPhotoLayout';
}
if ( is_array( $component ) ) {
// If the cover isn't first, give it a different layout.
if ( ! empty( $component['role'] ) && 'header' === $component['role'] && 0 !== $i ) {
$component['layout'] = 'headerBelowTextPhotoLayout';
}

$components[] = $component;
$components[] = $component;
}
}

return $components;
Expand Down

0 comments on commit d755ca5

Please sign in to comment.