You are here

public function LanguageSelectionPageConditionType::alterPageContent in Language Selection Page 8.2

Alter the $content render array used to build the LSP page.

Parameters

array &$content: The content render array.

string $destination: The destination path.

Overrides LanguageSelectionPageConditionBase::alterPageContent

File

src/Plugin/LanguageSelectionPageCondition/LanguageSelectionPageConditionType.php, line 87

Class

LanguageSelectionPageConditionType
Class for the Type condition plugin.

Namespace

Drupal\language_selection_page\Plugin\LanguageSelectionPageCondition

Code

public function alterPageContent(array &$content = [], $destination = '<front>') {

  // @todo update this using the config passed to the plugin.
  $config = $this->configFactory
    ->get('language_selection_page.negotiation');

  // Render the page if we have an array in $content instead of a
  // RedirectResponse. Otherwise, redirect the user.
  if ($config
    ->get('type') === 'standalone' && !$content instanceof RedirectResponse) {
    $content = [
      '#type' => 'page',
      '#title' => $config
        ->get('title'),
      'content' => $content,
    ];
  }
}