7.3 H5表单元素

Drupal8龡龝html5龏龎龊龉龅龃龀齼龏龎龊龉齸齵齱齰齬buildForm齛齗齓龅齑齍齵齌齊齈齇齄

1齂鼾鼺鼹鼵(tel)

$form['phone'] = array(
    '#type' => 'tel',
    '#title' => t('Phone'),
);

2齂鼂黿(email)

$form['email'] = array(
    '#type' => 'email',
    '#title' => t('Email'),
);

3齂黳黯(integer)

$form['integer'] = array(
    '#type' => 'number',
    '#title' => t('Some integer'),
    // The increment or decrement amount
    '#step' => 1,
    // Miminum allowed value
    '#min' => 0,
    // Maxmimum allowed value
    '#max' => 100,
);

4齂黍黊(date)

$form['date'] = array(
    '#type' => 'date',
    '#title' => t('Date'),
    '#date_date_format' => 'Y-m-d',
);

5齂黃黀URL(website)

$form['website'] = array(
    '#type' => 'url',
    '#title' => t('Website'),
);

6齂麱麯麮麫黯(search)

$form['search'] = array(
    '#type' => 'search',
    '#title' => t('Search'),
    '#autocomplete_route_name' => FALSE,
);

麧麥麡麟黀麛麗齼route_name龅麕麒麏麎麍麊麈麱麯齄

7齂麀鹾(range)

$form['range'] = array(
    '#type' => 'range',
    '#title' => t('Range'),
    '#min' => 0,
    '#max' => 100,
    '#step' => 1,
);

本书共79小节:

评论 (写第一个评论)