public function PageContext::__construct in Acquia Lift Connector 8.3
Same name and namespace in other branches
- 8.4 src/Service/Context/PageContext.php \Drupal\acquia_lift\Service\Context\PageContext::__construct()
- 8 src/Service/Context/PageContext.php \Drupal\acquia_lift\Service\Context\PageContext::__construct()
Constructor.
Parameters
\Drupal\Core\Config\ConfigFactoryInterface $config_factory: The config factory service.
\Drupal\Core\Entity\EntityTypeManagerInterface $entity_type_manager: Entity type manager.
\Symfony\Component\HttpFoundation\RequestStack $request_stack: The request stack.
\Drupal\Core\Routing\RouteMatchInterface $route_match: The current route match.
\Drupal\Core\Controller\TitleResolverInterface $title_resolver: The title resolver.
Drupal\Core\Language\LanguageManagerInterface $language_manager: The language manager.
File
- src/
Service/ Context/ PageContext.php, line 120
Class
Namespace
Drupal\acquia_lift\Service\ContextCode
public function __construct(ConfigFactoryInterface $config_factory, EntityTypeManagerInterface $entity_type_manager, RequestStack $request_stack, RouteMatchInterface $route_match, TitleResolverInterface $title_resolver, LanguageManagerInterface $language_manager) {
// Get all our settings.
$settings = $config_factory
->get('acquia_lift.settings');
// Set Credential information.
$credential_settings = $settings
->get('credential');
$this->assetsUrl = $credential_settings['assets_url'];
$this
->setContextCredential($credential_settings);
// Set mapping information.
$this->fieldMappings = $settings
->get('field_mappings');
$this->udfPersonMappings = $settings
->get('udf_person_mappings') ?: [];
$this->udfEventMappings = $settings
->get('udf_touch_mappings') ?: [];
$this->udfTouchMappings = $settings
->get('udf_event_mappings') ?: [];
// Set advanced configuration.
$this
->setContextAdvanced($settings
->get('advanced'));
// Set taxonomyTermStorage.
$this->taxonomyTermStorage = $entity_type_manager
->getStorage('taxonomy_term');
// Set page context
$request = $request_stack
->getCurrentRequest();
$route = $route_match
->getRouteObject();
// Set node context
$this
->setContextByNode($request);
// Set base data (title + language)
$this
->setBaseData($request, $route, $title_resolver, $language_manager);
}