function visualn_embed_form_visualn_iframe_configuration_alter

Implements hook_form_FORM_ID_alter().

Add visualn_embed drawings specific iframes configuration settings. Use 'visualn_iframe_configuration' form_id.

See also


Related topics


modules/visualn_embed/visualn_embed.module, line 201
Contains visualn_embed.module.


function visualn_embed_form_visualn_iframe_configuration_alter(&$form, FormStateInterface $form_state, $form_id) {
  $config = \Drupal::config('visualn_embed.iframe.settings');
  $form['visualn_embed'] = [
    '#type' => 'details',
    '#title' => 'VisualN Embed',
    '#open' => FALSE,

  // @todo: review key names
  // @todo: use the setting in Embedded Drawing properties form
  $form['visualn_embed']['allow_drawings_sharing'] = [
    '#type' => 'checkbox',
    '#title' => t('Allow Drawings sharing'),
    '#default_value' => $config
    '#description' => t('Allow sharing for VisualN drawings. Already shared iframes will still be available even if sharing disabled.'),

  // @todo: add a setting to hide/show exposed share links that wouldn't depend on the setting above
  $form['visualn_embed']['implicit_entries_restore'] = [
    '#type' => 'checkbox',
    '#title' => t('Enable missing iframe entries implicit restore'),
    '#default_value' => $config
    '#description' => t('Recreate VisualN embed drawings on drawing view if an iframe entry doesn\'t exist. Useful when settings embed settings manually. <strong>Should be used only when needed and commonly disabled</strong>.'),

  // @todo: maybe use array_unshift to execute it first and remove its values
  $form['#submit'][] = 'visualn_embed_iframe_configuration_form_submit';