/** * {@inheritdoc} */ public function buildConfigurationForm(array $form, FormStateInterface $form_state) { $form['theme'] = array('#type' => 'select', '#title' => $this->t('Theme'), '#default_value' => $this->configuration['theme'], '#options' => array_map(function ($theme_info) { return $theme_info->info['name']; }, $this->themeHandler->listInfo())); return parent::buildConfigurationForm($form, $form_state); }
/** * {@inheritdoc} */ public function buildConfigurationForm(array $form, FormStateInterface $form_state) { $options = array(); $node_types = $this->entityStorage->loadMultiple(); foreach ($node_types as $type) { $options[$type->type] = $type->name; } $form['bundles'] = array('#title' => $this->t('Node types'), '#type' => 'checkboxes', '#options' => $options, '#default_value' => $this->configuration['bundles']); return parent::buildConfigurationForm($form, $form_state); }
/** * {@inheritdoc} */ public function buildConfigurationForm(array $form, FormStateInterface $form_state) { $options = array(); $bundles = $this->entityTypeBundleInfo->getBundleInfo($this->bundleOf->id()); foreach ($bundles as $id => $info) { $options[$id] = $info['label']; } $form['bundles'] = array('#title' => $this->bundleOf->getBundleLabel(), '#type' => 'checkboxes', '#options' => $options, '#default_value' => $this->configuration['bundles']); return parent::buildConfigurationForm($form, $form_state); }
/** * {@inheritdoc} */ public function buildConfigurationForm(array $form, FormStateInterface $form_state) { // Sort all modules by their names. $modules = system_rebuild_module_data(); uasort($modules, 'system_sort_modules_by_info_name'); $options = array(NULL => t('Select a module')); foreach ($modules as $module_id => $module) { $options[$module_id] = $module->info['name']; } $form['module'] = array('#type' => 'select', '#title' => $this->t('Select a module to validate'), '#default_value' => $this->configuration['module'], '#options' => $options, '#description' => $this->t('Module selected status will be use to evaluate condition.')); return parent::buildConfigurationForm($form, $form_state); }
/** * {@inheritdoc} */ public function buildConfigurationForm(array $form, FormStateInterface $form_state) { $form = parent::buildConfigurationForm($form, $form_state); if (is_numeric($this->configuration['date'])) { $date = DrupalDateTime::createFromTimestamp($this->getDate()); } else { $date = new DrupalDateTime(); } // Add administrative comment publishing options. $form['date'] = array('#type' => 'datetime', '#date_date_element' => 'date', '#title' => $this->t('Date'), '#default_value' => $date, '#size' => 20, '#weight' => 50); $form['negate'] = array('#type' => 'radios', '#title' => $this->t('Timing'), '#description' => $this->t('Condition will be true if the time when evaluating this condition is before or after the date.'), '#options' => [0 => $this->t('After this date'), 1 => $this->t('Before this date')], '#default_value' => (int) $this->isNegated(), '#weight' => 100); return $form; }
/** * {@inheritdoc} */ public function buildConfigurationForm(array $form, FormStateInterface $form_state) { if (\Drupal::languageManager()->isMultilingual()) { // Fetch languages. $languages = language_list(LanguageInterface::STATE_CONFIGURABLE); $langcodes_options = array(); foreach ($languages as $language) { $langcodes_options[$language->getId()] = $language->getName(); } $form['langcodes'] = array('#type' => 'checkboxes', '#title' => t('Language selection'), '#default_value' => $this->configuration['langcodes'], '#options' => $langcodes_options, '#description' => t('Select languages to enforce. If none are selected, all languages will be allowed.')); } else { $form['langcodes'] = array('#type' => 'value', '#value' => $this->configuration['langcodes']); } return parent::buildConfigurationForm($form, $form_state); }
/** * {@inheritdoc} */ public function buildConfigurationForm(array $form, FormStateInterface $form_state) { $form['pages'] = array('#type' => 'textarea', '#title' => $this->t('Pages'), '#default_value' => $this->configuration['pages'], '#description' => $this->t("Specify pages by using their paths. Enter one path per line. The '*' character is a wildcard. Example paths are %user for the current user's page and %user-wildcard for every user page. %front is the front page.", array('%user' => 'user', '%user-wildcard' => 'user/*', '%front' => '<front>'))); return parent::buildConfigurationForm($form, $form_state); }
/** * {@inheritdoc} */ public function buildConfigurationForm(array $form, FormStateInterface $form_state) { $form['roles'] = array('#type' => 'checkboxes', '#title' => $this->t('When the user has the following roles'), '#default_value' => $this->configuration['roles'], '#options' => array_map('\\Drupal\\Component\\Utility\\Html::escape', user_role_names()), '#description' => $this->t('If you select no roles, the condition will evaluate to TRUE for all users.')); return parent::buildConfigurationForm($form, $form_state); }
/** * {@inheritdoc} */ public function buildConfigurationForm(array $form, FormStateInterface $form_state) { $form['age'] = ['#title' => $this->t('Node age, sec'), '#type' => 'number', '#min' => 0, '#default_value' => $this->configuration['age']]; return parent::buildConfigurationForm($form, $form_state); }
/** * {@inheritdoc} */ public function buildConfigurationForm(array $form, FormStateInterface $form_state) { $form['domains'] = array('#type' => 'checkboxes', '#title' => $this->t('When the following domains are active'), '#default_value' => $this->configuration['domains'], '#options' => array_map('\\Drupal\\Component\\Utility\\SafeMarkup::checkPlain', \Drupal::service('domain.loader')->loadOptionsList()), '#description' => $this->t('If you select no domains, the condition will evaluate to TRUE for all requests.'), '#attached' => array('library' => array('domain/drupal.domain'))); return parent::buildConfigurationForm($form, $form_state); }
/** * {@inheritdoc} */ public function buildConfigurationForm(array $form, FormStateInterface $form_state) { $options = []; // Loop over all defined blocks and filter them by provider, this builds an // array of blocks that are provided by the facets module. foreach ($this->blockManager->getDefinitions() as $definition) { if ($definition['provider'] == 'facets') { $options[$definition['id']] = $definition['label']; } } $form['facets'] = ['#title' => $this->t('Other facet blocks'), '#type' => 'radios', '#options' => $options, '#default_value' => $this->configuration['facets']]; $form['facet_value'] = ['#title' => $this->t('Facet value'), '#description' => $this->t('Only applies when a facet is already selected.'), '#type' => 'textfield', '#default_value' => $this->configuration['facet_value']]; return parent::buildConfigurationForm($form, $form_state); }
/** * */ public function buildConfigurationForm(array $form, FormStateInterface $form_state) { $block_visibility_groups = $this->entityStorage->loadMultiple(); $options = ['' => $this->t('No Block Visibility Group')]; foreach ($block_visibility_groups as $type) { $options[$type->id()] = $type->label(); } $form['block_visibility_group'] = array( '#title' => $this->t('Block Visibility Groups'), '#type' => 'select', '#options' => $options, // '#default_value' => $default,. ); $default = isset($this->configuration['block_visibility_group']) ? $this->configuration['block_visibility_group'] : ''; if (!$default) { $default = $this->request->query->get('block_visibility_group'); if ($default) { $form['block_visibility_group']['#disabled'] = TRUE; $form_state->setTemporaryValue('block_visibility_group_query', $default); } } $form['block_visibility_group']['#default_value'] = $default; // TODO: Change the autogenerated stub. $form = parent::buildConfigurationForm($form, $form_state); $form['negate']['#access'] = FALSE; return $form; }
/** * {@inheritdoc} */ public function buildConfigurationForm(array $form, FormStateInterface $form_state) { $form['collections'] = array('#title' => $this->t('Show on Collection pages'), '#type' => 'checkbox', '#default_value' => $this->configuration['collections']); return parent::buildConfigurationForm($form, $form_state); }