function imce_form_linkit_editor_dialog_form_alter in Linkit 8.4
Implements hook_form_BASE_FORM_ID_alter() for linkit_editor_dialog_form on behalf of the 'imce' module.
Adds a button to open the imce file browser if it is enabled.
File
- ./
linkit.module, line 82
Code
function imce_form_linkit_editor_dialog_form_alter(&$form, FormStateInterface $form_state) {
/** @var \Drupal\Linkit\ProfileInterface $linkit_profile */
$linkit_profile = $form_state
->getFormObject()
->getLinkitProfile();
if ($linkit_profile
->getThirdPartySetting('imce', 'use', FALSE)) {
$form['imce-link'] = [
'#type' => 'link',
'#title' => t('Open IMCE file browser'),
'#url' => Url::fromRoute('imce.page', [
'scheme' => $linkit_profile
->getThirdPartySetting('imce', 'scheme', 'public'),
]),
'#options' => array(
'query' => array(
'sendto' => 'linkitImce.sendto',
),
),
'#attributes' => [
'class' => [
'linkit-imce-open',
],
],
'#attached' => [
'library' => [
'linkit/linkit.imce',
],
],
'#weight' => 1,
];
}
}