You are here

protected function BlockVisibilityGroupedListBuilder::createHelp in Block Visibility Groups 8

Create a help description.

Parameters

array $form: The form array.

$group: The block visibility group instance.

Return value

array A renderable array.

1 call to BlockVisibilityGroupedListBuilder::createHelp()
BlockVisibilityGroupedListBuilder::buildForm in src/BlockVisibilityGroupedListBuilder.php
Form constructor.

File

src/BlockVisibilityGroupedListBuilder.php, line 409

Class

BlockVisibilityGroupedListBuilder
Extends BlockListBuilder to add our elements only show certain blocks.

Namespace

Drupal\block_visibility_groups

Code

protected function createHelp(BlockVisibilityGroup $group) {
  $help = '<strong>' . $this
    ->t('Currently viewing') . ': <em>' . $group
    ->label() . '</em></strong>';
  if ($group
    ->getLogic() == 'and') {
    $help .= '<p>' . $this
      ->t('All conditions must pass.') . '</p>';
  }
  else {
    $help .= '<p>' . $this
      ->t('Only one condition must pass.') . '</p>';
  }
  if ($group
    ->isAllowOtherConditions()) {
    $help .= '<p>' . $this
      ->t('Blocks in this group may have other conditions.') . '</p>';
  }
  else {
    $help .= '<p>' . $this
      ->t('Blocks in this group may <strong>not</strong> have other conditions.') . '</p>';
  }
  $help_group = [
    '#type' => 'details',
    '#open' => FALSE,
    '#title' => $this
      ->t('Group Settings'),
    'text' => [
      '#type' => 'markup',
      '#markup' => $help,
    ],
    'edit' => [
      '#type' => 'link',
      '#title' => t('Edit Group Settings'),
      '#url' => $group
        ->toUrl('edit-form'),
    ],
  ];
  return $help_group;
}