我的功能:
function _custom_get_ublox_communication_checkbox_form_element() {
return array(
'#type' => 'checkboxes',
'#title' => t('Communications'),
'#options' => array(
1 => t('I consent to retaining my personal data for the purposes of receiving personalized marketing materials, offers, invitations to webinars and other similar events. To learn more, read our <a )),
),
'#required' => TRUE,
);
}
此复选框是必选的,因为有选项'#required' =>TRUE,但是在删除必需选项之后,它甚至没有从字段中删除必需的(*)检查。
如果你只想使用一个复选框元素,你应该使用'checkbox' type而不是'checkboxes'
https://api.drupal.org/api/drupal/developer%21topics%21forms_api_reference.html/7.x复选框如果你不需要它,使用FALSE值
function _custom_get_ublox_communication_checkbox_form_element() {
return array(
'#type' => 'checkbox',
'#title' => t('I consent to retaining my personal data for the purposes of receiving personalized marketing materials, offers, invitations to webinars and other similar events. To learn more, read our <a'),
'#required' => FALSE,
);
}
测试前清除所有缓存