protected function All::actionDropdown in SimpleAds 8
Same name in this branch
- 8 src/Form/Ads/All.php \Drupal\simpleads\Form\Ads\All::actionDropdown()
- 8 src/Form/Campaigns/All.php \Drupal\simpleads\Form\Campaigns\All::actionDropdown()
1 call to All::actionDropdown()
- All::buildForm in src/
Form/ Campaigns/ All.php - Form constructor.
File
- src/
Form/ Campaigns/ All.php, line 89
Class
- All
- Configure SimpleAdsCampaigns settings.
Namespace
Drupal\simpleads\Form\CampaignsCode
protected function actionDropdown($form, $types) {
$links = [];
if (count($types) > 1) {
foreach ($types as $id => $name) {
$links[$id] = [
'title' => $this
->t('+ New @name', [
'@name' => $name,
]),
'url' => Url::fromRoute('simpleads.campaigns.new', [
'type' => $id,
]),
'attributes' => [
'class' => [
'button',
'form-submit',
],
],
];
}
$form['actions']['links'] = [
'#type' => 'dropbutton',
'#links' => $links,
'#prefix' => '<div class="simpleads-actions-wrapper">',
'#suffix' => '</div>',
];
}
else {
foreach ($types as $id => $name) {
$form['actions']['links'] = [
'#type' => 'link',
'#title' => $this
->t('+ New @name', [
'@name' => $name,
]),
'#url' => Url::fromRoute('simpleads.campaigns.new', [
'type' => $id,
]),
'#attributes' => [
'class' => [
'button',
'button--primary',
'form-submit',
],
],
'#prefix' => '<div class="simpleads-actions-wrapper single">',
'#suffix' => '</div>',
];
}
}
return $form;
}