public function FormHelper::createActionBar in Filebrowser 8.2
Same name and namespace in other branches
- 3.x src/Services/FormHelper.php \Drupal\filebrowser\Services\FormHelper::createActionBar()
File
- src/
Services/ FormHelper.php, line 37
Class
- FormHelper
- Class FormHelper Service that provides utilities to forms
Namespace
Drupal\filebrowser\ServicesCode
public function createActionBar(&$form, array $actions, $relative_fid) {
$form['action'] = [
'#type' => 'container',
'#attributes' => [
'id' => [
'form-action-actions-wrapper',
],
],
];
foreach ($actions as $action) {
switch ($action['type']) {
case 'link':
// Create a link that opens (JS) a form on the page
$form['action'][$action['operation']] = $this
->createLink($action, $this->node, $relative_fid);
break;
case 'button':
// Create a submit button that opens (JS) a form on the page
$form['action'][$action['operation']] = $this
->createAjaxButton($action);
break;
default:
// Create a normal submit button
$form['action'][$action['operation']] = $this
->createNormalButton($action);
}
}
}