public function SettingsController::editPopupSettings in Popup Maker - All popup types 8
Editing popup settings.
1 string reference to 'SettingsController::editPopupSettings'
File
- src/
Controller/ SettingsController.php, line 95
Class
- SettingsController
- Settings Controller to the popup maker module.
Namespace
Drupal\popup_maker\ControllerCode
public function editPopupSettings() {
$config = $this->configFactory
->get('popup_maker.settings');
$settings = [
'api_key' => $config
->get('api_key'),
'popups' => $config
->get('popups'),
'user' => $config
->get('user'),
'popupSettings' => $config
->get('popupSettings'),
];
$contentTypes = $this->entityManager
->getStorage('node_type')
->loadMultiple();
$displayRules = [];
if (!empty($contentTypes)) {
foreach ($contentTypes as $key => $contentType) {
$displayRules[$key] = [];
$nodes = $this->entityTypeManager
->getListBuilder('node')
->getStorage()
->loadByProperties([
'type' => $key,
]);
foreach ($nodes as $node) {
$displayRules[$key][$node
->id()] = $node
->getTitle();
}
}
}
return [
'#theme' => 'popup_maker_settings',
'#settings' => $settings,
'#edit' => TRUE,
'#editingPopupId' => (int) $_GET['id'],
'#displayRules' => $displayRules,
'#token' => $this->csrfToken
->get('popup_maker_api_key'),
'#attached' => [
'library' => [
'popup_maker/popup_maker_admin',
],
],
];
}