public function DomainListBuilder::buildForm in Domain Access 8
Form constructor.
Parameters
array $form: An associative array containing the structure of the form.
\Drupal\Core\Form\FormStateInterface $form_state: The current state of the form.
Return value
array The form structure.
Overrides DraggableListBuilder::buildForm
File
- domain/
src/ DomainListBuilder.php, line 253
Class
- DomainListBuilder
- User interface for the domain overview screen.
Namespace
Drupal\domainCode
public function buildForm(array $form, FormStateInterface $form_state) {
$form = parent::buildForm($form, $form_state);
$form[$this->entitiesKey]['#domains'] = $this->entities;
$form['actions']['submit']['#value'] = $this
->t('Save configuration');
// Only super-admins may sort domains.
if (!$this->currentUser
->hasPermission('administer domains')) {
$form['actions']['submit']['#access'] = FALSE;
unset($form['#tabledrag']);
}
// Delta is set after each row is loaded.
$count = count($this->domainStorage
->loadMultiple()) + 1;
foreach (Element::children($form['domains']) as $key) {
if (isset($form['domains'][$key]['weight'])) {
$form['domains'][$key]['weight']['#delta'] = $count;
}
}
return $form;
}