Skip to content

Commit

Permalink
Updated test
Browse files Browse the repository at this point in the history
  • Loading branch information
imonroe committed Oct 3, 2023
1 parent 7b8e8b6 commit ae93962
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -51,13 +51,13 @@ public function buildBehaviorForm(ParagraphInterface $paragraph, array &$form, F
* {@inheritDoc}
*/
public function view(array &$build, ParagraphInterface $paragraph, EntityViewDisplayInterface $display, $view_mode) {

if (!isset($build['su_list_view']) || !empty(Element::children($build['su_list_view']))) {
return;
}

// If there is no empty message set, it will be null.
$build['su_list_view']['#markup'] = $paragraph->getBehaviorSetting('list_paragraph', 'empty_message');
if ($paragraph->getBehaviorSetting('list_paragraph', 'empty_message')) {
$build['su_list_view']['#markup'] = $paragraph->getBehaviorSetting('list_paragraph', 'empty_message');
}

if ($paragraph->getBehaviorSetting('list_paragraph', 'hide_empty')) {
// D8CORE-6715: If the list is empty, the paragraph becomes uneditable.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,13 @@ public function testBehavior() {
$plugin->view($build, $paragraph, $display, 'default');
$this->assertEquals(['su_list_view' => [], '#cache' => []], $build);

$build = ['su_list_view' => [], '#cache' => []];
$build = [
'su_list_view' => [],
'su_list_button' => [],
'su_list_description' => [],
'su_list_headline' => [],
'#cache' => []
];
$this->paragraphBehavior['hide_empty'] = TRUE;
$plugin->view($build, $paragraph, $display, 'default');
$this->assertEquals(['#cache' => []], $build);
Expand Down

0 comments on commit ae93962

Please sign in to comment.