You are here

private function PageContext::setContextAdvanced in Acquia Lift Connector 8.4

Same name and namespace in other branches
  1. 8.3 src/Service/Context/PageContext.php \Drupal\acquia_lift\Service\Context\PageContext::setContextAdvanced()

Set page context - advanced.

Parameters

array $advanced_settings: Advanced settings array.

1 call to PageContext::setContextAdvanced()
PageContext::__construct in src/Service/Context/PageContext.php
Constructor.

File

src/Service/Context/PageContext.php, line 228

Class

PageContext

Namespace

Drupal\acquia_lift\Service\Context

Code

private function setContextAdvanced($advanced_settings) {
  $bootstrap_mode = isset($advanced_settings['bootstrap_mode']) ? $advanced_settings['bootstrap_mode'] : 'auto';
  $replacement_mode = $advanced_settings['content_replacement_mode'];
  $cdf_version = isset($advanced_settings['cdf_version']) ? $advanced_settings['cdf_version'] : SettingsHelper::CDF_VERSION_DEFAULT;
  if (SettingsHelper::isValidBootstrapMode($bootstrap_mode)) {
    $this->htmlHeadContexts['bootstrapMode'] = $bootstrap_mode;
  }
  if (SettingsHelper::isValidContentReplacementMode($replacement_mode)) {
    $this->htmlHeadContexts['contentReplacementMode'] = $replacement_mode;
  }
  if (SettingsHelper::isValidCdfVersion($cdf_version)) {
    $this->htmlHeadContexts['cdfVersion'] = $cdf_version;
  }
  if (!empty($advanced_settings['content_origins'])) {
    $content_origins = array_map('trim', explode("\n", trim($advanced_settings['content_origins'])));
    $content_origins = implode(',', $content_origins);
    if (!empty($content_origins)) {
      $this->htmlHeadContexts['content_origins'] = $content_origins;
    }
  }
}