You are here

mailhandler_demo.module in Mailhandler 8

Hook implementations for Mailhandler Demo module.

File

mailhandler_demo/mailhandler_demo.module
View source
<?php

/**
 * @file
 * Hook implementations for Mailhandler Demo module.
 */
use Drupal\Core\Form\FormStateInterface;

/**
 * Implements hook_form_FORM_ID_alter().
 */
function mailhandler_demo_form_inmail_demo_paste_alter(&$form, FormStateInterface $form_state) {
  $inmail_demo_examples = $form['example']['#options'];
  $directory = drupal_get_path('module', 'mailhandler_demo') . '/eml/';
  $examples = array_keys(file_scan_directory($directory, '/.*/'));
  $mailhandler_demo_examples = array_map('basename', array_combine($examples, $examples));
  $form['example']['#options'] = array_merge($inmail_demo_examples, $mailhandler_demo_examples);
}