function imce_form_linkit_profile_form_alter in Linkit 8.4
Implements hook_form_BASE_FORM_ID_alter() for linkit_profile_form on behalf of the 'imce' module.
Adds IMCE settings to the form.
See also
imce_form_linkit_profile_form_builder()
File
- ./
linkit.module, line 34
Code
function imce_form_linkit_profile_form_alter(&$form, FormStateInterface $form_state) {
/** @var \Drupal\Linkit\ProfileInterface $linkit_profile */
$linkit_profile = $form_state
->getFormObject()
->getEntity();
$form['imce'] = array(
'#type' => 'details',
'#title' => t('IMCE integration'),
'#group' => 'additional_settings',
);
$form['imce']['imce_use'] = array(
'#type' => 'checkbox',
'#title' => t('Enable IMCE File Browser in the editor dialog.'),
'#default_value' => $linkit_profile
->getThirdPartySetting('imce', 'use', FALSE),
);
$scheme_options = \Drupal::service('stream_wrapper_manager')
->getNames(StreamWrapperInterface::READ_VISIBLE);
$form['imce']['imce_scheme'] = array(
'#type' => 'radios',
'#title' => t('Scheme'),
'#options' => $scheme_options,
'#default_value' => $linkit_profile
->getThirdPartySetting('imce', 'scheme', 'public'),
'#states' => [
'visible' => [
':input[name="imce_use"]' => [
'checked' => TRUE,
],
],
],
);
$form['#entity_builders'][] = 'imce_form_linkit_profile_form_builder';
}