You are here

function editoria11y_form in Editoria11y Accessibility Checker 7

Page callback: editoria11y form.

See also

editoria11y_menu()

1 string reference to 'editoria11y_form'
editoria11y_menu in ./editoria11y.module
Implements hook_menu().

File

./editoria11y.module, line 43
Editoria11y module file.

Code

function editoria11y_form($form, &$form_state) {
  $form['setup'] = array(
    '#type' => 'fieldset',
    '#title' => t('Inclusions & exclusions'),
  );
  $form['setup']['editoria11y_content_root'] = [
    '#title' => t("Check content in this container"),
    '#type' => 'textfield',
    '#placeholder' => 'body',
    '#description' => t('If all editorial content is in <strong>one</strong> element (e.g., <code>main</code> or <code>#content</code>), provide that single <a href="https://developer.mozilla.org/en-US/docs/Learn/CSS/Building_blocks/Selectors">selector</a>.'),
    '#default_value' => variable_get('editoria11y_content_root'),
  ];
  $form['setup']['editoria11y_ignore_containers'] = [
    '#title' => t("Skip over these elements"),
    '#type' => 'textarea',
    '#placeholder' => '#toolbar-administration, .contextual-region > nav, .search-results',
    '#description' => t('Provide a comma-separated list of selectors for elements to ignore, such as <code>.my-embedded-social-media-feed, #sidebar-menu</code>.'),
    '#default_value' => variable_get('editoria11y_ignore_containers'),
  ];
  $form['setup']['editoria11y_no_load'] = [
    '#title' => t("Disable the scanner if these elements are detected"),
    '#type' => 'textarea',
    '#placeholder' => '#overlay-container, .panels-ipe-editing, #quickedit-entity-toolbar',
    '#description' => t('Provided a comma-separated list of selectors unique to pages or states that should not be scanned; e.g, during inline editing  (<code>#inline-editor-open</code>) or on pages without user-editable content (<code>.node-261, .front</code>).'),
    '#default_value' => variable_get('editoria11y_no_load'),
  ];
  $form['results'] = array(
    '#type' => 'fieldset',
    '#title' => t('Tests'),
  );
  $form['results']['editoria11y_assertiveness'] = [
    '#title' => t("Open the issue details panel automatically when new issues are detected"),
    '#type' => 'radios',
    '#options' => array(
      'smart' => t('When nodes are created or changed'),
      'assertive' => t('Always'),
      'polite' => t('Never'),
    ),
    '#description' => t('"Always" is not recommended for sites with multiple editors.'),
    '#default_value' => variable_get('editoria11y_assertiveness'),
  ];
  $form['results']['editoria11y_download_links'] = [
    '#title' => t("Warn that these links need manual review"),
    '#type' => 'textarea',
    '#placeholder' => "a[href\$='.pdf'], a[href*='.doc']",
    '#description' => t('Provide a comma-separated list of selectors for links that should have a "this file download needs a manual check" warning, e.g.: <code>[href^="/download"], .a[data-entity-substitution^="media"]</code>.'),
    '#default_value' => variable_get('editoria11y_download_links'),
  ];
  $form['results']['editoria11y_embedded_content_warning'] = [
    '#title' => t("Warn that these elements need manual review"),
    '#type' => 'textarea',
    '#description' => t('Provide a comma-separated list of selectors for elements with potentially complex issues, e.g.: <code>.my-embedded-feed, #my-social-link-block</code>.<br> Note that this test currently only runs during a "full check," and it <strong>ignores the ignore list</strong>: you are specifying that this element has not been checked.'),
    '#default_value' => variable_get('editoria11y_embedded_content_warning'),
  ];
  $form['theme'] = array(
    '#type' => 'fieldset',
    '#title' => t('Theme compatibility'),
  );
  $form['theme']['editoria11y_allow_overflow'] = [
    '#title' => t("Force these containers to allow overflow when tips are open"),
    '#type' => 'textarea',
    '#placeholder' => 'automatic',
    '#description' => t('Page elements themed with overflow:hidden will truncate tooltips that appear inside them. When this field is blank, Editoria11y tries to override this automatically. To manually choose which elements will toggle overflow, provide a comma-separated list of selectors for elements restricting overflow.'),
    '#default_value' => variable_get('editoria11y_allow_overflow'),
  ];
  $form['theme']['editoria11y_hidden_handlers'] = [
    '#title' => t("Theme JS will handle revealing hidden tooltips inside these containers"),
    '#type' => 'textarea',
    '#description' => t('Editoria11y detects hidden tooltips and warns the user when they try to jump to them from the panel. For elements on this list, Editoria11y will <a href="https://itmaybejj.github.io/editoria11y/#dealing-with-alerts-on-hidden-or-size-constrained-content">dispatch a JS event</a> instead of a warning, so custom JS in your theme can first reveal the hidden tip (e.g., open an accordion or tab panel).'),
    '#default_value' => variable_get('editoria11y_hidden_handlers'),
  ];
  $form['text'] = array(
    '#markup' => '<p>Configuration and troubleshooting tips: <ol><li><a href="/admin/people/permissions">Editorial roles</a> need to have the "View Editoria11y" permission.</li><li>If permissions are correct but the toggle still does not appear, selectors in the "disable the scanner if..." field could be present on the page.</li><li>If the toggle appears but errors are never found, make sure the "check content in" is set to the element that contains the content, and "skip over these" <strong><em>is not</em></strong>.</li><li>Note that an invalid configuration will prevent scanning and throw a JavaScript error; <a href="https://developer.mozilla.org/en-US/docs/Tools/Browser_Console">check the browser console</a></li></ol>',
  );
  return system_settings_form($form);
}