protected function MassContactForm::buildTaskList in Mass Contact 8
Builds the task list at the bottom of the mass contact form.
Parameters
array $form: The mass contact form definition.
1 call to MassContactForm::buildTaskList()
- MassContactForm::form in src/
Form/ MassContactForm.php - Gets the actual form array to be built.
File
- src/
Form/ MassContactForm.php, line 456
Class
- MassContactForm
- Main form for sending Mass Contact emails.
Namespace
Drupal\mass_contact\FormCode
protected function buildTaskList(array &$form) {
if ($this
->currentUser()
->hasPermission('mass contact administer')) {
$tasks = [];
if ($this
->currentUser()
->hasPermission('administer permissions')) {
$tasks[] = Link::createFromRoute($this
->t('Set Mass Contact permissions'), 'user.admin_permissions', [], [
'fragment' => 'module-mass_contact',
])
->toRenderable();
}
$tasks[] = Link::createFromRoute($this
->t('List current categories'), 'entity.mass_contact_category.collection')
->toRenderable();
$tasks[] = Link::createFromRoute($this
->t('Add new category'), 'entity.mass_contact_category.add_form')
->toRenderable();
$tasks[] = Link::createFromRoute($this
->t('Configure Mass Contact settings'), 'mass_contact.settings')
->toRenderable();
$tasks[] = Link::createFromRoute($this
->t('Help'), 'help.page', [
'name' => 'mass_contact',
])
->toRenderable();
$form['tasklist'] = [
'#type' => 'details',
// Open if there are no categories.
'#open' => empty($categories),
'#title' => $this
->t('Related tasks'),
];
$form['tasklist']['tasks'] = [
'#theme' => 'item_list',
'#items' => $tasks,
];
}
}