public function FormHelper::createLink in Filebrowser 8.2
Same name and namespace in other branches
- 3.x src/Services/FormHelper.php \Drupal\filebrowser\Services\FormHelper::createLink()
1 call to FormHelper::createLink()
- FormHelper::createActionBar in src/Services/FormHelper.php
File
- src/Services/FormHelper.php, line 64
Class
- FormHelper
- Class FormHelper
Service that provides utilities to forms
Namespace
Drupal\filebrowser\Services
Code
public function createLink(array $action, NodeInterface $node, $relative_fid) {
$route = 'filebrowser.action';
$is_add_folder_link = $action['operation'] == 'folder' ? 'add-folder-link' : '';
$link_options = [
'attributes' => [
'class' => [
'use-ajax',
'button',
'btn',
'btn-default',
$is_add_folder_link,
],
],
];
$route_options = [
'op' => $action['operation'],
'method' => 'nojs',
'nid' => $node
->id(),
'query_fid' => $relative_fid,
];
return [
'#markup' => Link::createFromRoute($action['title'], $route, $route_options, $link_options)
->toString(),
];
}