Skip to content

Commit

Permalink
Display images when group layout is horizontal
Browse files Browse the repository at this point in the history
Remove the restriction to only show data nodes in a horizontal layout.
Instead have it special case headers only, and then generically attempt
to use a pre-rendered 'value' that data nodes have or ask for the node
to be rendered to be displayed.

Should handle issue lkucharczyk#48
  • Loading branch information
Alex committed Dec 2, 2021
1 parent 4bd3503 commit 00b5056
Showing 1 changed file with 8 additions and 7 deletions.
15 changes: 8 additions & 7 deletions includes/services/PortableInfoboxRenderService.php
Expand Up @@ -266,21 +266,22 @@ private function createHorizontalGroupData( array $groupData ) {

foreach ( $groupData as $item ) {
$data = $item['data'];
$type = $item['type'];

if ( $item['type'] === 'data' ) {
if ( $type === 'header' ) {
$horizontalGroupData['header'] = $data['value'];
$horizontalGroupData['inlineStyles'] = $this->inlineStyles;
}else{

This comment has been minimized.

Copy link
@winstonsung

winstonsung Dec 3, 2021

Coding conventions:

} else {

$horizontalGroupData['data'][] = [
'label' => $data['label'],
'value' => $data['value'],
'source' => $item['data']['source'] ?? "",
'item-name' => $item['data']['item-name']
'value' => $data['value'] ?? $this->renderItem($type,$data),

This comment has been minimized.

Copy link
@winstonsung

winstonsung Dec 3, 2021

Coding conventions:

$data['value'] ?? $this->renderItem( $type, $data ),

'source' => $data['source'] ?? "",
'item-name' => $data['item-name']
];

if ( !empty( $data['label'] ) ) {
$horizontalGroupData['renderLabels'] = true;
}
} elseif ( $item['type'] === 'header' ) {
$horizontalGroupData['header'] = $data['value'];
$horizontalGroupData['inlineStyles'] = $this->inlineStyles;
}
}

Expand Down

0 comments on commit 00b5056

Please sign in to comment.