Showing posts with label drupal theme. Show all posts
Showing posts with label drupal theme. Show all posts

How to redirect a form in drupal

<?php

function MODULENAME_form_alter(&$form, $form_state, $form_id){
global $user;
switch ($form_id) {
// This is our form ID.
case 'YOUR_NODE_FORM_ID': // like page_node_form(for node/add/page)
$form['buttons']['submit']['#submit'][] = 'redirect_this_form';
break;
}
}
function redirect_this_form($form, &$form_state) {
if ($form_state['nid']) {
$node = node_load(array('nid' => $form_state['nid']));
switch($node->type) {
case 'page':
$form_state['redirect'] = 'pages'; // you should specicify here where want to redirect the form after submission
}
}
}

?>

How to create a link image in drupal

this snippet enables you to create a image link

print l('Business Package - Human Resource Information System (HRIS) ','solutions/hris_ja',array('html' => TRUE));

notice there are 3 parameters: l(1st_param,2nd_param,3rd_param);

1st_param: the html image
2nd_param: the url/path
3rd_param: enable html to TRUE

http://www.arnelbornales.site90.net/blog