code snippet

1 answers

How to enter code snippet in HTML or Drupal?

Read more »

How to debug in Drupal using drupal_set_message and come to the exact line that is causing the error?

Put the following code snippet in includes/bootstrap.inc in the drupal_set_message function.. . <code>  if ($type == 'error') {     $message .= '<pre>'. print_r(debug_backtrace(), 1) .'</pre>';   } </code>

Remove Tabs from Drupal Site

Use the following function in '_phptemplate_variables' function in template.php. In the following code snippet, if I want to remove the "Edit" tab: <?php function _phptemplate_variables($hook, $vars = array()) {   if($hook == 'page') { yourthemename_removetab('Edit', $vars); // add additional lines here to remove other tabs }   return $vars; }   function yourthemename_removetab($label, &$vars) { $tabs = explode("\n", $vars['tabs']); $vars['tabs'] = '';   foreach($tabs as $tab) { if(strpos($tab, '>' . $label . '<') === FALSE) {