You are here

required_by_role_test.module in Required by role 7

Same filename and directory in other branches
  1. 7.2 tests/required_by_role_test/required_by_role_test.module

Module for testing.

File

tests/required_by_role_test/required_by_role_test.module
View source
<?php

/**
 * @file
 * Module for testing.
 */

/**
 * Implements hook_menu().
 */
function required_by_role_test_menu() {
  $items = array();
  $items['form-date-element-test'] = array(
    'title' => 'Form date element test.',
    'page callback' => 'drupal_get_form',
    'page arguments' => array(
      'required_by_role_test_date_select_form',
    ),
    'access callback' => TRUE,
  );
  return $items;
}

/**
 * Implements hook_form().
 */
function required_by_role_test_date_select_form($form, &$form_state) {
  $form = array(
    '#date' => new DateTime(),
  );
  $form['date'] = array(
    '#type' => 'date_popup',
    '#date_format' => 'm/d/Y',
    '#default_value' => $form['#date']
      ->format('Y-m-d'),
  );
  $form['submit'] = array(
    '#type' => 'submit',
    '#value' => t('Submit'),
  );
  return $form;
}