System settings form():修订间差异
来自站长百科
无编辑摘要 |
无编辑摘要 |
||
第3行: | 第3行: | ||
'''system_settings_form($form)''' -- | '''system_settings_form($form)''' --很重要的一个函数,在设置后台表单时候经常用到。主要用于为一个表单添加按钮和设置前缀. | ||
'''参数''': | '''参数''': | ||
第13行: | 第13行: | ||
表单结构。 | 表单结构。 | ||
'''实例''': | |||
<pre> | |||
<?php | |||
function onthisdate_admin() { | |||
$form = array(); | |||
$form['onthisdate_maxdisp'] = array( | |||
'#type' => 'textfield', | |||
'#title' => t('Maximum number of links'), | |||
'#default_value' => variable_get('onthisdate_maxdisp', 3), | |||
'#size' => 2, | |||
'#maxlength' => 2, | |||
'#description' => t("The maximum number of links to display in the block."), | |||
'#required' => TRUE, | |||
); | |||
return system_settings_form($form); | |||
} | |||
?> | |||
</pre> | |||
[[category:API|D]] | [[category:API|D]] | ||
[[category:Drupal|D]] | [[category:Drupal|D]] |
2010年7月11日 (日) 17:09的版本
导航: 上一页 | 首页 | DedeCMS | 帝国CMS | Xoops | SupeSite | PHPCMS | PHP168 | Joomla
system_settings_form($form) --很重要的一个函数,在设置后台表单时候经常用到。主要用于为一个表单添加按钮和设置前缀.
参数:
$form 一个包含表单结构的关联数组。
返回值:
表单结构。
实例:
<?php function onthisdate_admin() { $form = array(); $form['onthisdate_maxdisp'] = array( '#type' => 'textfield', '#title' => t('Maximum number of links'), '#default_value' => variable_get('onthisdate_maxdisp', 3), '#size' => 2, '#maxlength' => 2, '#description' => t("The maximum number of links to display in the block."), '#required' => TRUE, ); return system_settings_form($form); } ?>