From 34005f808565b1736b93e78af5feb3fa617d749e Mon Sep 17 00:00:00 2001 From: Christian Fritsch Date: Fri, 15 Mar 2019 16:39:42 +0100 Subject: [PATCH 1/7] Issue #3040605: Order of optional thunder modules install is wrong --- .../src}/Annotation/ThunderOptionalModule.php | 2 +- .../Installer/Form/ModuleConfigureForm.php | 10 ++-- .../src}/OptionalModulesManager.php | 12 ++--- .../thunder_install}/OptionalModule/AMP.php | 2 +- .../OptionalModule/AbstractOptionalModule.php | 2 +- .../OptionalModule/Adsense.php | 2 +- .../FacebookInstantArticles.php | 2 +- .../OptionalModule/GoogleAnalytics.php | 2 +- .../OptionalModule/Harbourmaster.php | 2 +- .../OptionalModule/IvwIntegration.php | 2 +- .../OptionalModule/Liveblog.php | 2 +- .../OptionalModule/NexxIntegration.php | 2 +- .../OptionalModule/RiddleIntegration.php | 2 +- .../OptionalModule/ThunderDemo.php | 2 +- .../thunder_install/thunder_install.info.yml | 5 ++ .../thunder_install.services.yml | 4 ++ thunder.info.yml | 1 + thunder.profile | 52 +++++++++++++------ thunder.services.yml | 4 -- 19 files changed, 69 insertions(+), 43 deletions(-) rename {src => modules/thunder_install/src}/Annotation/ThunderOptionalModule.php (94%) rename {src => modules/thunder_install/src}/Installer/Form/ModuleConfigureForm.php (92%) rename {src => modules/thunder_install/src}/OptionalModulesManager.php (71%) rename {src/Plugin/Thunder => modules/thunder_install/src/Plugin/thunder_install}/OptionalModule/AMP.php (93%) rename {src/Plugin/Thunder => modules/thunder_install/src/Plugin/thunder_install}/OptionalModule/AbstractOptionalModule.php (97%) rename {src/Plugin/Thunder => modules/thunder_install/src/Plugin/thunder_install}/OptionalModule/Adsense.php (94%) rename {src/Plugin/Thunder => modules/thunder_install/src/Plugin/thunder_install}/OptionalModule/FacebookInstantArticles.php (83%) rename {src/Plugin/Thunder => modules/thunder_install/src/Plugin/thunder_install}/OptionalModule/GoogleAnalytics.php (96%) rename {src/Plugin/Thunder => modules/thunder_install/src/Plugin/thunder_install}/OptionalModule/Harbourmaster.php (93%) rename {src/Plugin/Thunder => modules/thunder_install/src/Plugin/thunder_install}/OptionalModule/IvwIntegration.php (94%) rename {src/Plugin/Thunder => modules/thunder_install/src/Plugin/thunder_install}/OptionalModule/Liveblog.php (96%) rename {src/Plugin/Thunder => modules/thunder_install/src/Plugin/thunder_install}/OptionalModule/NexxIntegration.php (95%) rename {src/Plugin/Thunder => modules/thunder_install/src/Plugin/thunder_install}/OptionalModule/RiddleIntegration.php (94%) rename {src/Plugin/Thunder => modules/thunder_install/src/Plugin/thunder_install}/OptionalModule/ThunderDemo.php (83%) create mode 100644 modules/thunder_install/thunder_install.info.yml create mode 100644 modules/thunder_install/thunder_install.services.yml delete mode 100644 thunder.services.yml diff --git a/src/Annotation/ThunderOptionalModule.php b/modules/thunder_install/src/Annotation/ThunderOptionalModule.php similarity index 94% rename from src/Annotation/ThunderOptionalModule.php rename to modules/thunder_install/src/Annotation/ThunderOptionalModule.php index 0b6bffe1b..5c7667516 100644 --- a/src/Annotation/ThunderOptionalModule.php +++ b/modules/thunder_install/src/Annotation/ThunderOptionalModule.php @@ -1,6 +1,6 @@ get('config.factory'), - $container->get('plugin.manager.thunder.optional_modules') + $container->get('plugin.manager.thunder_install.optional_modules') ); } diff --git a/src/OptionalModulesManager.php b/modules/thunder_install/src/OptionalModulesManager.php similarity index 71% rename from src/OptionalModulesManager.php rename to modules/thunder_install/src/OptionalModulesManager.php index 6bb23c6e8..725b33540 100644 --- a/src/OptionalModulesManager.php +++ b/modules/thunder_install/src/OptionalModulesManager.php @@ -1,6 +1,6 @@ alterInfo('thunder_optional_module_info'); - $this->setCacheBackend($cache_backend, 'thunder_optional_module_plugins'); + $this->alterInfo('thunder_install_optional_module_info'); + $this->setCacheBackend($cache_backend, 'thunder_install_optional_module_plugins'); } diff --git a/src/Plugin/Thunder/OptionalModule/AMP.php b/modules/thunder_install/src/Plugin/thunder_install/OptionalModule/AMP.php similarity index 93% rename from src/Plugin/Thunder/OptionalModule/AMP.php rename to modules/thunder_install/src/Plugin/thunder_install/OptionalModule/AMP.php index c51f06fe5..633be3f6b 100644 --- a/src/Plugin/Thunder/OptionalModule/AMP.php +++ b/modules/thunder_install/src/Plugin/thunder_install/OptionalModule/AMP.php @@ -1,6 +1,6 @@ [ + 'display_name' => t('Configure additional modules'), + 'type' => 'form', + 'function' => 'Drupal\thunder_install\Installer\Form\ModuleConfigureForm', + ], + 'thunder_module_install' => [ + 'display_name' => t('Install additional modules'), + 'type' => 'batch', + ], + 'thunder_finish_installation' => [ + 'display_name' => t('Finish installation'), + ], + ]; + } + return $tasks; +} + +/** + * Implements hook_install_tasks_alter(). + */ +function thunder_install_tasks_alter(&$tasks, $install_state) { + if (!empty($install_state['config_install_path'])) { + return; + } + $key = array_search('install_install_profile', array_keys($tasks), TRUE); - $tasks = [ - 'thunder_module_configure_form' => [ - 'display_name' => t('Configure additional modules'), - 'type' => 'form', - 'function' => 'Drupal\thunder\Installer\Form\ModuleConfigureForm', - ], - 'thunder_module_install' => [ - 'display_name' => t('Install additional modules'), - 'type' => 'batch', - ], - 'thunder_finish_installation' => [ - 'display_name' => t('Finish installation'), - ], - ]; + $config_tasks['thunder_module_configure_form'] = $tasks['thunder_module_configure_form']; + $config_tasks['thunder_module_install'] = $tasks['thunder_module_install']; + unset($tasks['thunder_module_configure_form']); + unset($tasks['thunder_module_install']); - return $tasks; + $tasks = array_slice($tasks, 0, $key, TRUE) + + $config_tasks + + array_slice($tasks, $key, NULL, TRUE); } /** @@ -86,7 +106,7 @@ function thunder_module_install(array &$install_state) { function _thunder_install_module_batch($module, $module_name, $form_values, &$context) { set_time_limit(0); - $optionalModulesManager = \Drupal::service('plugin.manager.thunder.optional_modules'); + $optionalModulesManager = \Drupal::service('plugin.manager.thunder_install.optional_modules'); try { $definition = $optionalModulesManager->getDefinition($module_name); diff --git a/thunder.services.yml b/thunder.services.yml deleted file mode 100644 index 04ae0f485..000000000 --- a/thunder.services.yml +++ /dev/null @@ -1,4 +0,0 @@ -services: - plugin.manager.thunder.optional_modules: - class: Drupal\thunder\OptionalModulesManager - parent: default_plugin_manager From fd2b9d82556187cac9314c6757354dd8c579c619 Mon Sep 17 00:00:00 2001 From: Christian Fritsch Date: Thu, 11 Apr 2019 13:09:05 -0700 Subject: [PATCH 2/7] Simplifying --- modules/thunder_demo/thunder_demo.info.yml | 2 - .../config/install/tour.tour.content-add.yml | 4 +- .../config/install/tour.tour.content-list.yml | 4 +- .../install/tour.tour.content-paragraphs.yml | 4 +- .../config/install/tour.tour.homepage.yml | 4 +- modules/thunder_help/thunder_help.info.yml | 8 + .../thunder_help.module} | 2 +- .../src/Annotation/ThunderOptionalModule.php | 46 ----- .../Installer/Form/ModuleConfigureForm.php | 161 ------------------ .../src/OptionalModulesManager.php | 38 ----- .../thunder_install/OptionalModule/AMP.php | 43 ----- .../OptionalModule/AbstractOptionalModule.php | 100 ----------- .../OptionalModule/Adsense.php | 51 ------ .../FacebookInstantArticles.php | 15 -- .../OptionalModule/GoogleAnalytics.php | 53 ------ .../OptionalModule/Harbourmaster.php | 36 ---- .../OptionalModule/IvwIntegration.php | 52 ------ .../OptionalModule/Liveblog.php | 74 -------- .../OptionalModule/NexxIntegration.php | 54 ------ .../OptionalModule/RiddleIntegration.php | 47 ----- .../OptionalModule/ThunderDemo.php | 17 -- .../thunder_install/thunder_install.info.yml | 5 - .../thunder_install.services.yml | 4 - src/Installer/Form/ModuleConfigureForm.php | 128 ++++++++++++++ thunder.info.yml | 1 - thunder.profile | 86 ++-------- 26 files changed, 162 insertions(+), 877 deletions(-) rename modules/{thunder_demo => thunder_help}/config/install/tour.tour.content-add.yml (98%) rename modules/{thunder_demo => thunder_help}/config/install/tour.tour.content-list.yml (98%) rename modules/{thunder_demo => thunder_help}/config/install/tour.tour.content-paragraphs.yml (98%) rename modules/{thunder_demo => thunder_help}/config/install/tour.tour.homepage.yml (98%) create mode 100644 modules/thunder_help/thunder_help.info.yml rename modules/{thunder_demo/thunder_demo.module => thunder_help/thunder_help.module} (92%) delete mode 100644 modules/thunder_install/src/Annotation/ThunderOptionalModule.php delete mode 100644 modules/thunder_install/src/Installer/Form/ModuleConfigureForm.php delete mode 100644 modules/thunder_install/src/OptionalModulesManager.php delete mode 100644 modules/thunder_install/src/Plugin/thunder_install/OptionalModule/AMP.php delete mode 100644 modules/thunder_install/src/Plugin/thunder_install/OptionalModule/AbstractOptionalModule.php delete mode 100644 modules/thunder_install/src/Plugin/thunder_install/OptionalModule/Adsense.php delete mode 100644 modules/thunder_install/src/Plugin/thunder_install/OptionalModule/FacebookInstantArticles.php delete mode 100644 modules/thunder_install/src/Plugin/thunder_install/OptionalModule/GoogleAnalytics.php delete mode 100644 modules/thunder_install/src/Plugin/thunder_install/OptionalModule/Harbourmaster.php delete mode 100644 modules/thunder_install/src/Plugin/thunder_install/OptionalModule/IvwIntegration.php delete mode 100644 modules/thunder_install/src/Plugin/thunder_install/OptionalModule/Liveblog.php delete mode 100644 modules/thunder_install/src/Plugin/thunder_install/OptionalModule/NexxIntegration.php delete mode 100644 modules/thunder_install/src/Plugin/thunder_install/OptionalModule/RiddleIntegration.php delete mode 100644 modules/thunder_install/src/Plugin/thunder_install/OptionalModule/ThunderDemo.php delete mode 100644 modules/thunder_install/thunder_install.info.yml delete mode 100644 modules/thunder_install/thunder_install.services.yml create mode 100644 src/Installer/Form/ModuleConfigureForm.php diff --git a/modules/thunder_demo/thunder_demo.info.yml b/modules/thunder_demo/thunder_demo.info.yml index 9b396db4a..71510b257 100644 --- a/modules/thunder_demo/thunder_demo.info.yml +++ b/modules/thunder_demo/thunder_demo.info.yml @@ -6,5 +6,3 @@ core: 8.x dependencies: - better_normalizers:better_normalizers - default_content:default_content - - drupal:tour - - drupal:help diff --git a/modules/thunder_demo/config/install/tour.tour.content-add.yml b/modules/thunder_help/config/install/tour.tour.content-add.yml similarity index 98% rename from modules/thunder_demo/config/install/tour.tour.content-add.yml rename to modules/thunder_help/config/install/tour.tour.content-add.yml index 8fbff5ab4..25d515370 100644 --- a/modules/thunder_demo/config/install/tour.tour.content-add.yml +++ b/modules/thunder_help/config/install/tour.tour.content-add.yml @@ -2,10 +2,10 @@ langcode: en status: true dependencies: module: - - thunder_demo + - thunder_help id: content-add label: 'Add new content' -module: thunder_demo +module: thunder_help routes: - route_name: node.add diff --git a/modules/thunder_demo/config/install/tour.tour.content-list.yml b/modules/thunder_help/config/install/tour.tour.content-list.yml similarity index 98% rename from modules/thunder_demo/config/install/tour.tour.content-list.yml rename to modules/thunder_help/config/install/tour.tour.content-list.yml index 196790b9a..2f321d9af 100644 --- a/modules/thunder_demo/config/install/tour.tour.content-list.yml +++ b/modules/thunder_help/config/install/tour.tour.content-list.yml @@ -2,10 +2,10 @@ langcode: en status: true dependencies: module: - - thunder_demo + - thunder_help id: content-list label: 'Content listing' -module: thunder_demo +module: thunder_help routes: - route_name: view.content.page_1 diff --git a/modules/thunder_demo/config/install/tour.tour.content-paragraphs.yml b/modules/thunder_help/config/install/tour.tour.content-paragraphs.yml similarity index 98% rename from modules/thunder_demo/config/install/tour.tour.content-paragraphs.yml rename to modules/thunder_help/config/install/tour.tour.content-paragraphs.yml index 7a1f2aa7f..e184d7dd1 100644 --- a/modules/thunder_demo/config/install/tour.tour.content-paragraphs.yml +++ b/modules/thunder_help/config/install/tour.tour.content-paragraphs.yml @@ -2,10 +2,10 @@ langcode: en status: true dependencies: module: - - thunder_demo + - thunder_help id: content-paragraphs label: 'Introduction to paragraphs' -module: thunder_demo +module: thunder_help routes: - route_name: entity.node.edit_form diff --git a/modules/thunder_demo/config/install/tour.tour.homepage.yml b/modules/thunder_help/config/install/tour.tour.homepage.yml similarity index 98% rename from modules/thunder_demo/config/install/tour.tour.homepage.yml rename to modules/thunder_help/config/install/tour.tour.homepage.yml index 4ed92586a..063c9fe82 100644 --- a/modules/thunder_demo/config/install/tour.tour.homepage.yml +++ b/modules/thunder_help/config/install/tour.tour.homepage.yml @@ -2,10 +2,10 @@ langcode: en status: true dependencies: module: - - thunder_demo + - thunder_help id: homepage label: Homepage -module: thunder_demo +module: thunder_help routes: - route_name: view.frontpage.page_1 diff --git a/modules/thunder_help/thunder_help.info.yml b/modules/thunder_help/thunder_help.info.yml new file mode 100644 index 000000000..b1fc3dd53 --- /dev/null +++ b/modules/thunder_help/thunder_help.info.yml @@ -0,0 +1,8 @@ +name: Thunder Help +type: module +description: Provides a tour and some help. +package: Thunder +core: 8.x +dependencies: + - drupal:tour + - drupal:help diff --git a/modules/thunder_demo/thunder_demo.module b/modules/thunder_help/thunder_help.module similarity index 92% rename from modules/thunder_demo/thunder_demo.module rename to modules/thunder_help/thunder_help.module index 5ac737574..15e726dcc 100644 --- a/modules/thunder_demo/thunder_demo.module +++ b/modules/thunder_help/thunder_help.module @@ -13,7 +13,7 @@ use Drupal\Core\Entity\EntityInterface; * Tour depends a lot on used theme. Because of that whitelist is provided, to * ensure that tour is loaded only if proper theme is used. */ -function thunder_demo_tour_tips_alter(array &$tour_tips, EntityInterface $entity) { +function thunder_help_tour_tips_alter(array &$tour_tips, EntityInterface $entity) { // Whitelist of tours for frontend and backend theme. $tourThemeMapping = [ 'homepage' => ['thunder_base'], diff --git a/modules/thunder_install/src/Annotation/ThunderOptionalModule.php b/modules/thunder_install/src/Annotation/ThunderOptionalModule.php deleted file mode 100644 index 5c7667516..000000000 --- a/modules/thunder_install/src/Annotation/ThunderOptionalModule.php +++ /dev/null @@ -1,46 +0,0 @@ -optionalModulesManager = $optionalModulesManager; - } - - /** - * {@inheritdoc} - */ - public static function create(ContainerInterface $container) { - return new static( - $container->get('config.factory'), - $container->get('plugin.manager.thunder_install.optional_modules') - ); - } - - /** - * {@inheritdoc} - */ - public function getFormId() { - return 'thunder_module_configure_form'; - } - - /** - * {@inheritdoc} - */ - protected function getEditableConfigNames() { - - return []; - } - - /** - * {@inheritdoc} - */ - public function buildForm(array $form, FormStateInterface $form_state) { - - // We have to delete all messages, because simple_sitemap adds a bunch of - // messages during the install process. - // @see https://www.drupal.org/project/simple_sitemap/issues/3001388. - $this->messenger()->deleteAll(); - - $form['description'] = [ - '#type' => 'item', - '#markup' => $this->t('Keep calm. You can install all the modules later, too.'), - ]; - - $form['install_modules'] = [ - '#type' => 'container', - ]; - - $providers = $this->optionalModulesManager->getDefinitions(); - - static::sortByWeights($providers); - - foreach ($providers as $provider) { - - $instance = $this->optionalModulesManager->createInstance($provider['id']); - - $form['install_modules_' . $provider['id']] = [ - '#type' => 'checkbox', - '#title' => $provider['label'], - '#description' => isset($provider['description']) ? $provider['description'] : '', - '#default_value' => isset($provider['standardlyEnabled']) ? $provider['standardlyEnabled'] : 0, - ]; - - $form = $instance->buildForm($form, $form_state); - - } - $form['#title'] = $this->t('Install & configure modules'); - - $form['actions'] = ['#type' => 'actions']; - $form['actions']['save'] = [ - '#type' => 'submit', - '#value' => $this->t('Save and continue'), - '#button_type' => 'primary', - '#submit' => ['::submitForm'], - ]; - - return $form; - } - - /** - * {@inheritdoc} - */ - public function submitForm(array &$form, FormStateInterface $form_state) { - $installModules = []; - - foreach ($form_state->getValues() as $key => $value) { - - if (strpos($key, 'install_modules') !== FALSE && $value) { - preg_match('/install_modules_(?P\w+)/', $key, $values); - $installModules[] = $values['name']; - } - } - - $buildInfo = $form_state->getBuildInfo(); - - $install_state = $buildInfo['args']; - - $install_state[0]['thunder_additional_modules'] = $installModules; - $install_state[0]['form_state_values'] = $form_state->getValues(); - - $buildInfo['args'] = $install_state; - - $form_state->setBuildInfo($buildInfo); - - } - - /** - * Returns a sorting function to sort an array by weights. - * - * If an array element doesn't provide a weight, it will be set to 0. - * If two elements have the same weight, they are sorted by label. - * - * @param array $array - * The array to be sorted. - */ - private static function sortByWeights(array &$array) { - uasort($array, function ($a, $b) { - $a_weight = isset($a['weight']) ? $a['weight'] : 0; - $b_weight = isset($b['weight']) ? $b['weight'] : 0; - - if ($a_weight == $b_weight) { - return ($a['label'] > $b['label']) ? 1 : -1; - } - return ($a_weight > $b_weight) ? 1 : -1; - }); - } - -} diff --git a/modules/thunder_install/src/OptionalModulesManager.php b/modules/thunder_install/src/OptionalModulesManager.php deleted file mode 100644 index 725b33540..000000000 --- a/modules/thunder_install/src/OptionalModulesManager.php +++ /dev/null @@ -1,38 +0,0 @@ -alterInfo('thunder_install_optional_module_info'); - $this->setCacheBackend($cache_backend, 'thunder_install_optional_module_plugins'); - - } - -} diff --git a/modules/thunder_install/src/Plugin/thunder_install/OptionalModule/AMP.php b/modules/thunder_install/src/Plugin/thunder_install/OptionalModule/AMP.php deleted file mode 100644 index 633be3f6b..000000000 --- a/modules/thunder_install/src/Plugin/thunder_install/OptionalModule/AMP.php +++ /dev/null @@ -1,43 +0,0 @@ - 'item', - '#description' => $this->t("ATTENTION: Due to licensing issues, - you have to download the needed library manually, before activating this module. - With composer installed execute the command `composer require lullabot/amp` - in the docroot of your installation."), - ]; - } - else { - unset($form['thunder_amp']); - } - - return $form; - - } - -} diff --git a/modules/thunder_install/src/Plugin/thunder_install/OptionalModule/AbstractOptionalModule.php b/modules/thunder_install/src/Plugin/thunder_install/OptionalModule/AbstractOptionalModule.php deleted file mode 100644 index c63b7d694..000000000 --- a/modules/thunder_install/src/Plugin/thunder_install/OptionalModule/AbstractOptionalModule.php +++ /dev/null @@ -1,100 +0,0 @@ -entityTypeManager = $entityTypeManager; - $this->configFactory = $configFactory; - } - - /** - * {@inheritdoc} - */ - public static function create(ContainerInterface $container, array $configuration, $plugin_id, $plugin_definition) { - return new static( - $configuration, - $plugin_id, - $plugin_definition, - $container->get('entity_type.manager'), - $container->get('config.factory') - ); - } - - /** - * {@inheritdoc} - */ - public function buildForm(array $form, FormStateInterface $form_state) { - - // Check if this method is overridden. - $reflection = new \ReflectionClass($this); - foreach ($reflection->getMethods() as $method) { - if ($method->name == 'buildForm') { - if ($method->class != get_class($this)) { - return $form; - } - } - } - - $form[$this->getBaseId()] = [ - '#type' => 'details', - '#title' => $this->pluginDefinition['label'], - '#open' => TRUE, - '#states' => [ - 'visible' => [ - ':input[name="install_modules_' . $this->getBaseId() . '"]' => ['checked' => TRUE], - ], - ], - ]; - - return $form; - } - - /** - * {@inheritdoc} - */ - public function submitForm(array $formValues) { - } - -} diff --git a/modules/thunder_install/src/Plugin/thunder_install/OptionalModule/Adsense.php b/modules/thunder_install/src/Plugin/thunder_install/OptionalModule/Adsense.php deleted file mode 100644 index e53dafe89..000000000 --- a/modules/thunder_install/src/Plugin/thunder_install/OptionalModule/Adsense.php +++ /dev/null @@ -1,51 +0,0 @@ - 'textfield', - '#title' => t('Site Google AdSense Publisher ID'), - '#required' => FALSE, - '#default_value' => '', - '#pattern' => 'pub-[0-9]+', - '#description' => t('This is the Google AdSense Publisher ID for the site owner. It is used if no other ID is suitable. Get this in your Google Adsense account. It should be similar to %id.', [ - '%id' => 'pub-9999999999999', - ] - ), - ]; - - return $form; - } - - /** - * {@inheritdoc} - */ - public function submitForm(array $formValues) { - - $this->configFactory->getEditable('adsense.settings') - ->set('adsense_basic_id', (string) $formValues['adsense_basic_id']) - ->save(TRUE); - } - -} diff --git a/modules/thunder_install/src/Plugin/thunder_install/OptionalModule/FacebookInstantArticles.php b/modules/thunder_install/src/Plugin/thunder_install/OptionalModule/FacebookInstantArticles.php deleted file mode 100644 index 8fa0367de..000000000 --- a/modules/thunder_install/src/Plugin/thunder_install/OptionalModule/FacebookInstantArticles.php +++ /dev/null @@ -1,15 +0,0 @@ - t('This ID is unique to each site you want to track separately, and is in the form of UA-xxxxxxx-yy. To get a Web Property ID, register your site with Google Analytics, or if you already have registered your site, go to your Google Analytics Settings page to see the ID next to every site profile. Find more information in the documentation.', [ - ':analytics' => 'http://www.google.com/analytics/', - ':webpropertyid' => Url::fromUri('https://developers.google.com/analytics/resources/concepts/gaConceptsAccounts', ['fragment' => 'webProperty']) - ->toString(), - ]), - '#maxlength' => 20, - '#placeholder' => 'UA-', - '#size' => 15, - '#title' => t('Web Property ID'), - '#type' => 'textfield', - ]; - - return $form; - } - - /** - * {@inheritdoc} - */ - public function submitForm(array $formValues) { - - $this->configFactory->getEditable('google_analytics.settings') - ->set('account', (string) $formValues['ga_account']) - ->save(TRUE); - } - -} diff --git a/modules/thunder_install/src/Plugin/thunder_install/OptionalModule/Harbourmaster.php b/modules/thunder_install/src/Plugin/thunder_install/OptionalModule/Harbourmaster.php deleted file mode 100644 index 6d91abd3e..000000000 --- a/modules/thunder_install/src/Plugin/thunder_install/OptionalModule/Harbourmaster.php +++ /dev/null @@ -1,36 +0,0 @@ - 'item', - '#markup' => $this->t('Integrates Harbourmaster providing a single sign-on solution for Drupal. You will need an instance of the harbourmaster running. See harbourmaster documentation for more details.', [ - ':url' => 'https://valiton.github.io/harbourmaster-docs/index.html', - ]), - ]; - - return $form; - } - -} diff --git a/modules/thunder_install/src/Plugin/thunder_install/OptionalModule/IvwIntegration.php b/modules/thunder_install/src/Plugin/thunder_install/OptionalModule/IvwIntegration.php deleted file mode 100644 index 92a1382c0..000000000 --- a/modules/thunder_install/src/Plugin/thunder_install/OptionalModule/IvwIntegration.php +++ /dev/null @@ -1,52 +0,0 @@ - 'textfield', - '#title' => t('IVW Site name'), - '#description' => t('Site name as given by IVW, this is used as default for the "st" parameter in the iam_data object'), - ]; - - $form['ivw_integration']['mobile_site'] = [ - '#type' => 'textfield', - '#title' => t('IVW Mobile Site name'), - '#description' => t('Mobile site name as given by IVW, this is used as default for the "st" parameter in the iam_data object'), - ]; - - return $form; - } - - /** - * {@inheritdoc} - */ - public function submitForm(array $formValues) { - - $this->configFactory->getEditable('ivw_integration.settings') - ->set('site', (string) $formValues['ivw_site']) - ->set('mobile_site', (string) $formValues['mobile_site']) - ->save(TRUE); - } - -} diff --git a/modules/thunder_install/src/Plugin/thunder_install/OptionalModule/Liveblog.php b/modules/thunder_install/src/Plugin/thunder_install/OptionalModule/Liveblog.php deleted file mode 100644 index 909b0636d..000000000 --- a/modules/thunder_install/src/Plugin/thunder_install/OptionalModule/Liveblog.php +++ /dev/null @@ -1,74 +0,0 @@ - 'item', - '#markup' => $this->t('Register a new account at :pusher_url, create a new app and note down your keys and cluster. You can provide them right here or at a later stage on the liveblog settings form.', - [':pusher_url' => 'http://pusher.com']), - ]; - - $form['thunder_liveblog']['pusher_app_id'] = [ - '#type' => 'textfield', - '#title' => t('App ID'), - ]; - - $form['thunder_liveblog']['pusher_key'] = [ - '#type' => 'textfield', - '#title' => t('Key'), - ]; - - $form['thunder_liveblog']['pusher_secret'] = [ - '#type' => 'textfield', - '#title' => t('Secret'), - ]; - - $form['thunder_liveblog']['pusher_cluster'] = [ - '#type' => 'textfield', - '#title' => t('Cluster'), - '#description' => t('The cluster name to connect to. Leave empty for the default cluster: mt1 (US east coast)'), - ]; - - return $form; - } - - /** - * {@inheritdoc} - */ - public function submitForm(array $formValues) { - $this->configFactory->getEditable('liveblog.notification_channel.liveblog_pusher') - ->set('app_id', $formValues['pusher_app_id']) - ->set('key', $formValues['pusher_key']) - ->set('secret', $formValues['pusher_secret']) - ->set('cluster', $formValues['pusher_cluster']) - ->save(TRUE); - - if ($formValues['pusher_app_id'] && $formValues['pusher_key'] && $formValues['pusher_secret']) { - $this->configFactory->getEditable('liveblog.settings') - ->set('notification_channel', 'liveblog_pusher') - ->save(TRUE); - } - } - -} diff --git a/modules/thunder_install/src/Plugin/thunder_install/OptionalModule/NexxIntegration.php b/modules/thunder_install/src/Plugin/thunder_install/OptionalModule/NexxIntegration.php deleted file mode 100644 index 210b0a3dd..000000000 --- a/modules/thunder_install/src/Plugin/thunder_install/OptionalModule/NexxIntegration.php +++ /dev/null @@ -1,54 +0,0 @@ - 'item', - '#markup' => $this->t('Register a new account at http://www.nexx.tv/thunder and get a domain ID and an installation code. You can provide theme right here or at a later stage on the nexx Settings form', - [':nexx_url' => 'http://www.nexx.tv/thunder']), - ]; - - $form['nexx_integration']['omnia_id'] = [ - '#type' => 'textfield', - '#title' => $this->t('Domain ID'), - ]; - $form['nexx_integration']['nexx_api_authkey'] = [ - '#type' => 'textfield', - '#title' => $this->t('Installation Code'), - ]; - - return $form; - } - - /** - * {@inheritdoc} - */ - public function submitForm(array $formValues) { - $this->configFactory->getEditable('nexx_integration.settings') - ->set('nexx_api_authkey', $formValues['nexx_api_authkey']) - ->set('omnia_id', $formValues['omnia_id']) - ->save(TRUE); - } - -} diff --git a/modules/thunder_install/src/Plugin/thunder_install/OptionalModule/RiddleIntegration.php b/modules/thunder_install/src/Plugin/thunder_install/OptionalModule/RiddleIntegration.php deleted file mode 100644 index d7d503ab2..000000000 --- a/modules/thunder_install/src/Plugin/thunder_install/OptionalModule/RiddleIntegration.php +++ /dev/null @@ -1,47 +0,0 @@ - 'textfield', - '#title' => $this->t('Riddle token'), - '#description' => $this->t('Register a new account at riddle.com and get a token from the Account->Plugins page (you may need to reset to get the first token). To get a free riddle basic account use this voucher "THUNDER_3eX4_freebasic".', - [':riddle' => 'http://www.riddle.com']), - ]; - - return $form; - } - - /** - * {@inheritdoc} - */ - public function submitForm(array $formValues) { - - $this->configFactory->getEditable('riddle_marketplace.settings') - ->set('riddle_marketplace.token', (string) $formValues['riddle_token']) - ->save(TRUE); - - } - -} diff --git a/modules/thunder_install/src/Plugin/thunder_install/OptionalModule/ThunderDemo.php b/modules/thunder_install/src/Plugin/thunder_install/OptionalModule/ThunderDemo.php deleted file mode 100644 index 4cdaa75e8..000000000 --- a/modules/thunder_install/src/Plugin/thunder_install/OptionalModule/ThunderDemo.php +++ /dev/null @@ -1,17 +0,0 @@ - [ + 'type' => 'module', + 'label' => 'AdSense', + 'description' => 'With Google AdSense, you can earn money from your online content', + ], + 'thunder_amp' => [ + 'type' => 'theme', + 'label' => 'AMP', + 'description' => 'The Google AMP project strives for better performance, especially on mobile devices.', + ], + 'thunder_help' => [ + 'type' => 'module', + 'label' => 'Help', + 'description' => 'Provides a tour to learn more about Thunder', + ], + 'thunder_fia' => [ + 'type' => 'module', + 'label' => 'Facebook Instant Articles', + 'description' => 'A new way for any publisher to create fast, interactive articles on Facebook.', + ], + 'google_analytics' => [ + 'type' => 'module', + 'label' => "Google Analytics", + 'description' => "Google Analytics lets you measure your advertising ROI as well as track your video, and social networking sites and applications.", + ], + 'harbourmaster' => [ + 'type' => 'module', + 'label' => "Harbourmaster SSO connector", + 'description' => "Harbourmaster is providing a single sign-on solution.", + ], + 'ivw_integration' => [ + 'type' => 'module', + 'label' => "IVW Integration", + 'description' => "Integration module for the German audience measurement organisation IVW.", + ], + 'thunder_liveblog' => [ + 'type' => 'module', + 'label' => "Liveblog", + 'description' => "The Liveblog module allows you to distribute blog posts to thousands of users in realtime.", + ], + 'nexx_integration' => [ + 'type' => 'module', + 'label' => "Nexx video integration", + 'description' => "nexx.tv offers end-to-end online video platform solutions.", + ], + 'thunder_riddle' => [ + 'type' => 'module', + 'label' => "Riddle integration", + 'description' => "Riddle makes it easy to quickly create beautiful and highly shareable quizzes, tests, lists, polls, and more.", + ], + ]; + + /** + * {@inheritdoc} + */ + public function getFormId() { + return 'thunder_module_configure_form'; + } + + /** + * {@inheritdoc} + */ + public function buildForm(array $form, FormStateInterface $form_state) { + $form['description'] = [ + '#type' => 'item', + '#markup' => $this->t('Keep calm. You can install all the modules later, too.'), + ]; + + $options = $descriptions = []; + foreach ($this->providers as $id => $provider) { + $options[$id] = $provider['label']; + $descriptions[$id] = ['#description' => $provider['description']]; + } + + $form['install_modules'] = [ + '#type' => 'checkboxes', + '#title' => 'Select modules', + '#options' => $options, + ] + $descriptions; + + $form['#title'] = $this->t('Select additional modules'); + + $form['actions'] = ['#type' => 'actions']; + $form['actions']['save'] = [ + '#type' => 'submit', + '#value' => $this->t('Save and continue'), + '#button_type' => 'primary', + '#submit' => ['::submitForm'], + ]; + + return $form; + } + + /** + * {@inheritdoc} + */ + public function submitForm(array &$form, FormStateInterface $form_state) { + $system_modules = \Drupal::state()->get('install_profile_modules'); + + $themes = []; + foreach (array_filter($form_state->getValue('install_modules')) as $item) { + if ($this->providers[$item]['type'] === 'module') { + $system_modules[] = $item; + } + elseif ($this->providers[$item]['type'] === 'theme') { + $install_state['profile_info']['themes'][] = $item; + $themes[] = $item; + } + } + + \Drupal::service('theme_installer')->install($themes); + \Drupal::state()->set('install_profile_modules', $system_modules); + } + +} diff --git a/thunder.info.yml b/thunder.info.yml index b4aad2dcb..f3a99b04e 100644 --- a/thunder.info.yml +++ b/thunder.info.yml @@ -87,7 +87,6 @@ install: - thunder:thunder_media - thunder:thunder_paragraphs - thunder:thunder_taxonomy - - thunder:thunder_install themes: - seven - thunder_base diff --git a/thunder.profile b/thunder.profile index c26b6e6c0..c0658f120 100644 --- a/thunder.profile +++ b/thunder.profile @@ -20,6 +20,14 @@ use Drupal\user\Entity\Role; function thunder_form_install_configure_form_alter(&$form, FormStateInterface $form_state) { // Add a value as example that one can choose an arbitrary site name. $form['site_information']['site_name']['#placeholder'] = t('Thunder'); + $form['demo_content'] = [ + '#type' => 'checkbox', + '#title' => 'Install Demo Content', + '#description' => 'Installs demo content to show how Thunder works.', + '#default_value' => TRUE + ]; + + $form['#submit'][] = 'thunder_install_configure_form_submit'; } /** @@ -28,16 +36,14 @@ function thunder_form_install_configure_form_alter(&$form, FormStateInterface $f function thunder_install_tasks(&$install_state) { $tasks = []; if (empty($install_state['config_install_path'])) { + $profile_path = drupal_get_path('profile', 'thunder'); + include_once $profile_path . '/src/Installer/Form/ModuleConfigureForm.php'; $tasks = [ 'thunder_module_configure_form' => [ - 'display_name' => t('Configure additional modules'), + 'display_name' => t('Select additional modules'), 'type' => 'form', 'function' => 'Drupal\thunder_install\Installer\Form\ModuleConfigureForm', ], - 'thunder_module_install' => [ - 'display_name' => t('Install additional modules'), - 'type' => 'batch', - ], ]; } $tasks['thunder_finish_installation'] = [ @@ -51,15 +57,13 @@ function thunder_install_tasks(&$install_state) { * Implements hook_install_tasks_alter(). */ function thunder_install_tasks_alter(&$tasks, $install_state) { - if (empty($install_state['thunder_module_configure_form'])) { + if (empty($tasks['thunder_module_configure_form'])) { return; } - $key = array_search('install_install_profile', array_keys($tasks), TRUE); + $key = array_search('install_profile_modules', array_keys($tasks), TRUE); $config_tasks['thunder_module_configure_form'] = $tasks['thunder_module_configure_form']; - $config_tasks['thunder_module_install'] = $tasks['thunder_module_install']; unset($tasks['thunder_module_configure_form']); - unset($tasks['thunder_module_install']); $tasks = array_slice($tasks, 0, $key, TRUE) + $config_tasks + @@ -67,66 +71,12 @@ function thunder_install_tasks_alter(&$tasks, $install_state) { } /** - * Installs the thunder modules in a batch. - * - * @param array $install_state - * The install state. - * - * @return array - * A batch array to execute. - */ -function thunder_module_install(array &$install_state) { - - $modules = $install_state['thunder_additional_modules']; - - $batch = []; - if ($modules) { - $operations = []; - foreach ($modules as $module) { - $operations[] = [ - '_thunder_install_module_batch', - [[$module], $module, $install_state['form_state_values']], - ]; - } - - $batch = [ - 'operations' => $operations, - 'title' => t('Installing additional modules'), - 'error_message' => t('The installation has encountered an error.'), - ]; - } - - return $batch; -} - -/** - * Implements callback_batch_operation(). - * - * Performs batch installation of modules. + * Implements hook_form_submit(). */ -function _thunder_install_module_batch($module, $module_name, $form_values, &$context) { - set_time_limit(0); - - $optionalModulesManager = \Drupal::service('plugin.manager.thunder_install.optional_modules'); - - try { - $definition = $optionalModulesManager->getDefinition($module_name); - if ($definition['type'] == 'module') { - \Drupal::service('module_installer')->install($module, TRUE); - } - elseif ($definition['type'] == 'theme') { - \Drupal::service('theme_installer')->install($module, TRUE); - } - - $instance = $optionalModulesManager->createInstance($module_name); - $instance->submitForm($form_values); - } - catch (\Exception $e) { - +function thunder_install_configure_form_submit(array &$form, FormStateInterface $form_state) { + if ($form_state->getValue('demo_content')) { + \Drupal::service('module_installer')->install(['thunder_demo']); } - - $context['results'][] = $module; - $context['message'] = t('Installed %module_name modules.', ['%module_name' => $module_name]); } /** @@ -138,8 +88,6 @@ function _thunder_install_module_batch($module, $module_name, $form_values, &$co * @throws \Drupal\Core\Entity\EntityStorageException */ function thunder_finish_installation(array &$install_state) { - \Drupal::service('config.installer')->installOptionalConfig(); - // Assign user 1 the "administrator" role. $user = User::load(1); $user->roles[] = 'administrator'; From 7664f81785867718a2c431787816d61547917818 Mon Sep 17 00:00:00 2001 From: Christian Fritsch Date: Thu, 11 Apr 2019 13:14:35 -0700 Subject: [PATCH 3/7] Fix CS --- thunder.profile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/thunder.profile b/thunder.profile index c0658f120..c1f918b5c 100644 --- a/thunder.profile +++ b/thunder.profile @@ -24,7 +24,7 @@ function thunder_form_install_configure_form_alter(&$form, FormStateInterface $f '#type' => 'checkbox', '#title' => 'Install Demo Content', '#description' => 'Installs demo content to show how Thunder works.', - '#default_value' => TRUE + '#default_value' => TRUE, ]; $form['#submit'][] = 'thunder_install_configure_form_submit'; From b5e369315ed9876ca037cce7584a8d6812324e65 Mon Sep 17 00:00:00 2001 From: Christian Fritsch Date: Thu, 11 Apr 2019 13:25:56 -0700 Subject: [PATCH 4/7] CS fixes --- src/Installer/Form/ModuleConfigureForm.php | 46 +++++++++++++++++++--- thunder.profile | 4 +- 2 files changed, 43 insertions(+), 7 deletions(-) diff --git a/src/Installer/Form/ModuleConfigureForm.php b/src/Installer/Form/ModuleConfigureForm.php index 6539e30f3..69feb9897 100644 --- a/src/Installer/Form/ModuleConfigureForm.php +++ b/src/Installer/Form/ModuleConfigureForm.php @@ -2,14 +2,51 @@ namespace Drupal\thunder_install\Installer\Form; +use Drupal\Core\Extension\ThemeInstallerInterface; use Drupal\Core\Form\FormBase; use Drupal\Core\Form\FormStateInterface; +use Drupal\Core\State\StateInterface; +use Symfony\Component\DependencyInjection\ContainerInterface; /** * Provides the site configuration form. */ class ModuleConfigureForm extends FormBase { + /** + * The state service. + * + * @var \Drupal\Core\State\StateInterface + */ + protected $state; + + /** + * The theme installer service. + * + * @var \Drupal\Core\Extension\ThemeInstallerInterface + */ + protected $themeInstaller; + + /** + * ModuleConfigureForm constructor. + * + * @param \Drupal\Core\State\StateInterface $state + * The state service. + * @param \Drupal\Core\Extension\ThemeInstallerInterface $installer + * The theme installer service. + */ + public function __construct(StateInterface $state, ThemeInstallerInterface $installer) { + $this->state = $state; + $this->themeInstaller = $installer; + } + + /** + * {@inheritdoc} + */ + public static function create(ContainerInterface $container) { + return new static($container->get('state'), $container->get('theme_installer')); + } + protected $providers = [ 'adsense' => [ 'type' => 'module', @@ -87,7 +124,7 @@ public function buildForm(array $form, FormStateInterface $form_state) { $form['install_modules'] = [ '#type' => 'checkboxes', - '#title' => 'Select modules', + '#title' => $this->t('Select modules'), '#options' => $options, ] + $descriptions; @@ -108,7 +145,7 @@ public function buildForm(array $form, FormStateInterface $form_state) { * {@inheritdoc} */ public function submitForm(array &$form, FormStateInterface $form_state) { - $system_modules = \Drupal::state()->get('install_profile_modules'); + $system_modules = $this->state->get('install_profile_modules'); $themes = []; foreach (array_filter($form_state->getValue('install_modules')) as $item) { @@ -116,13 +153,12 @@ public function submitForm(array &$form, FormStateInterface $form_state) { $system_modules[] = $item; } elseif ($this->providers[$item]['type'] === 'theme') { - $install_state['profile_info']['themes'][] = $item; $themes[] = $item; } } - \Drupal::service('theme_installer')->install($themes); - \Drupal::state()->set('install_profile_modules', $system_modules); + $this->themeInstaller->install($themes); + $this->state->set('install_profile_modules', $system_modules); } } diff --git a/thunder.profile b/thunder.profile index c1f918b5c..24f17316a 100644 --- a/thunder.profile +++ b/thunder.profile @@ -22,8 +22,8 @@ function thunder_form_install_configure_form_alter(&$form, FormStateInterface $f $form['site_information']['site_name']['#placeholder'] = t('Thunder'); $form['demo_content'] = [ '#type' => 'checkbox', - '#title' => 'Install Demo Content', - '#description' => 'Installs demo content to show how Thunder works.', + '#title' => t('Install Demo Content'), + '#description' => t('Installs demo content to show how Thunder works.'), '#default_value' => TRUE, ]; From 0759161b7ad3c57658612a015e0f162fc9a7a141 Mon Sep 17 00:00:00 2001 From: Christian Fritsch Date: Thu, 11 Apr 2019 13:34:56 -0700 Subject: [PATCH 5/7] Fix namespace --- src/Installer/Form/ModuleConfigureForm.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Installer/Form/ModuleConfigureForm.php b/src/Installer/Form/ModuleConfigureForm.php index 69feb9897..c12d48734 100644 --- a/src/Installer/Form/ModuleConfigureForm.php +++ b/src/Installer/Form/ModuleConfigureForm.php @@ -1,6 +1,6 @@ Date: Thu, 11 Apr 2019 13:44:50 -0700 Subject: [PATCH 6/7] Fix namespace --- thunder.profile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/thunder.profile b/thunder.profile index 24f17316a..ce726d4a5 100644 --- a/thunder.profile +++ b/thunder.profile @@ -42,7 +42,7 @@ function thunder_install_tasks(&$install_state) { 'thunder_module_configure_form' => [ 'display_name' => t('Select additional modules'), 'type' => 'form', - 'function' => 'Drupal\thunder_install\Installer\Form\ModuleConfigureForm', + 'function' => 'Drupal\thunder\Installer\Form\ModuleConfigureForm', ], ]; } From ced192ee44b59d5d985c06803b8924beeed5cd70 Mon Sep 17 00:00:00 2001 From: Christian Fritsch Date: Mon, 15 Apr 2019 07:41:42 +0200 Subject: [PATCH 7/7] WIP --- scripts/travis/04-install-thunder.sh | 2 +- src/Installer/Form/ModuleConfigureForm.php | 47 +++++++++++++++++++++- 2 files changed, 47 insertions(+), 2 deletions(-) diff --git a/scripts/travis/04-install-thunder.sh b/scripts/travis/04-install-thunder.sh index d3a113a3c..b0182b159 100755 --- a/scripts/travis/04-install-thunder.sh +++ b/scripts/travis/04-install-thunder.sh @@ -5,7 +5,7 @@ install_thunder() { cd $1 - /usr/bin/env PHP_OPTIONS="-d sendmail_path=`which true`" drush si thunder --db-url=mysql://travis@127.0.0.1/drupal -y thunder_module_configure_form.install_modules_thunder_demo + /usr/bin/env PHP_OPTIONS="-d sendmail_path=`which true`" drush si thunder --db-url=mysql://travis@127.0.0.1/drupal -y install_configure_form.demo_content drush en simpletest -y drush -y sql-dump --result-file=${DEPLOYMENT_DUMP_FILE} diff --git a/src/Installer/Form/ModuleConfigureForm.php b/src/Installer/Form/ModuleConfigureForm.php index c12d48734..826417077 100644 --- a/src/Installer/Form/ModuleConfigureForm.php +++ b/src/Installer/Form/ModuleConfigureForm.php @@ -6,6 +6,7 @@ use Drupal\Core\Form\FormBase; use Drupal\Core\Form\FormStateInterface; use Drupal\Core\State\StateInterface; +use Drupal\Core\Url; use Symfony\Component\DependencyInjection\ContainerInterface; /** @@ -116,10 +117,18 @@ public function buildForm(array $form, FormStateInterface $form_state) { '#markup' => $this->t('Keep calm. You can install all the modules later, too.'), ]; - $options = $descriptions = []; + $options = $descriptions = $module_form = $actions = []; foreach ($this->providers as $id => $provider) { $options[$id] = $provider['label']; $descriptions[$id] = ['#description' => $provider['description']]; + + if (method_exists($this, $id . '_form')) { + $module_form[$id] = $this->{$id . '_form'}(); + } + + if (method_exists($this, $id . '_form_submit')) { + $actions[] = '::' . $id . '_form_submit'; + } } $form['install_modules'] = [ @@ -128,6 +137,8 @@ public function buildForm(array $form, FormStateInterface $form_state) { '#options' => $options, ] + $descriptions; + $form += $module_form; + $form['#title'] = $this->t('Select additional modules'); $form['actions'] = ['#type' => 'actions']; @@ -161,4 +172,38 @@ public function submitForm(array &$form, FormStateInterface $form_state) { $this->state->set('install_profile_modules', $system_modules); } + protected function google_analytics_form() { + return [ + 'ga_account' => [ + '#description' => t('This ID is unique to each site you want to track separately, and is in the form of UA-xxxxxxx-yy. To get a Web Property ID, register your site with Google Analytics, or if you already have registered your site, go to your Google Analytics Settings page to see the ID next to every site profile. Find more information in the documentation.', [ + ':analytics' => 'http://www.google.com/analytics/', + ':webpropertyid' => Url::fromUri('https://developers.google.com/analytics/resources/concepts/gaConceptsAccounts', ['fragment' => 'webProperty']) + ->toString(), + ]), + '#maxlength' => 20, + '#placeholder' => 'UA-', + '#size' => 15, + '#title' => t('Web Property ID'), + '#type' => 'textfield', + ], + ]; + } + + protected function google_analytics_form() { + return [ + 'ga_account' => [ + '#description' => t('This ID is unique to each site you want to track separately, and is in the form of UA-xxxxxxx-yy. To get a Web Property ID, register your site with Google Analytics, or if you already have registered your site, go to your Google Analytics Settings page to see the ID next to every site profile. Find more information in the documentation.', [ + ':analytics' => 'http://www.google.com/analytics/', + ':webpropertyid' => Url::fromUri('https://developers.google.com/analytics/resources/concepts/gaConceptsAccounts', ['fragment' => 'webProperty']) + ->toString(), + ]), + '#maxlength' => 20, + '#placeholder' => 'UA-', + '#size' => 15, + '#title' => t('Web Property ID'), + '#type' => 'textfield', + ], + ]; + } + }