我坚持在Drupal中添加LinkButton。 Linkbutton类似于: -
<form action="http://google.com/" method="get">
<button style="width:200px;height:40px; background:#4788CC;color:white;font face:verdana">
ADD THINGS
</button>
</form>
我想使用与上面提到的HTML相同的Drupal API创建LinkButton。
答案 0 :(得分:0)
看看drupal的Form API:
您可以尝试这样的事情:
/**
* Implements hook_menu().
*/
function moduleName_menu(){
$items = array();
$items['url'] = array(
'title' => 'Test',
'page callback' => 'drupal_get_form',
'page arguments' => array('my_form'),
'access arguments' => array('access content'),
);
return $items;
}
function my_form(){
$form = array();
$form['my_field'] = array(
'#type' => 'submit',
'#value' => t('Go'),
);
return $form;
}
function my_form_submit($form, &$form_state) {
$form_state['rebuild'] = TRUE;
$form_state['redirect'] = 'custom url';
}