configFactory = $config_factory; $this->moduleHandler = $module_handler; $this->pathValidator = $path_validator; $this->addonsManager = $addons_manager; $this->config = $this->configFactory->getEditable('webform.settings'); $this->loadIncludes(); } /** * Load all third party settings includes. * * @see {module}/{module}.webform.inc * @see {module}/webform/{module}.webform.inc * @see webform/webform.{module}.inc */ protected function loadIncludes() { $modules = array_keys($this->moduleHandler->getModuleList()); foreach ($modules as $module) { $this->moduleHandler->loadInclude($module, 'webform.inc'); $this->moduleHandler->loadInclude($module, 'webform.inc', "webform/$module"); $this->moduleHandler->loadInclude('webform', "inc", "third_party_settings/webform.$module"); } } /** * {@inheritdoc} */ public function alter($type, &$data, &$context1 = NULL, &$context2 = NULL) { $this->moduleHandler->alter($type, $data, $context1, $context2); } /** * {@inheritdoc} */ public function buildForm(array $form, FormStateInterface $form_state) { $form['third_party_settings'] = [ '#tree' => TRUE, ]; $form['#after_build'] = [[$this, 'afterBuild']]; return $form; } /** * {@inheritdoc} */ public function afterBuild(array $form, FormStateInterface $form_state) { // If third party settings are empty. if (!isset($form['third_party_settings']) || !Element::children($form['third_party_settings'])) { // Hide all actions including the 'Save configuration' button. $form['actions']['#access'] = FALSE; // Display a warning. drupal_set_message($this->t('There are no third party settings available. Please install a contributed module that integrates with the Webform module.'), 'warning'); // Link to supported Third party settings modules. $form['supported'] = [ 'title' => [ '#markup' => $this->t('Supported modules.'), '#prefix' => '