Created
September 6, 2012 01:09
-
-
Save carwin/3649371 to your computer and use it in GitHub Desktop.
Drupal 6: Use hook_form_alter() to remove the "Remove" button on Ubercart's cart form
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
function modulename_form_alter(&$form, $form_state, $form_id) { | |
switch ( $form_id ) { | |
case 'uc_cart_view_form': | |
/* | |
* This is how you can remove the "remove" | |
* button for each item. | |
*/ | |
foreach($form['items'] as $k => $v ) { | |
if(is_integer($k) && isset($v['remove'])) { | |
unset($form['items'][$k]['remove']); | |
} | |
} | |
/* | |
* If you remove the "remove" button from the form | |
* you'll want to remove the table head (thead) cell text. | |
*/ | |
foreach($form['items']['#columns'] as $k => $v) { | |
unset($form['items']['#columns'][$k]['cell']); | |
} | |
/* | |
* This is how you can remove the "remove" column entirely. | |
*/ | |
unset($form['items']['#columns']['remove']); | |
unset($form['update']); | |
break; | |
default : | |
break; | |
} | |
} | |
?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment