Revert drupal settings so the new export in code is used
function toggleHelp(element) {
/**
$(element).toggleClass('close');
toggleNice($(element).parents('.helptekst').find('.helptekst_inner'), $(element).hasClass('close'));
return false;
}
* Change this to jQuery.fn
*/
function toggleNice(element, close) {
if (!close) {
element.slideUp('normal');
}
else {
element.slideDown('normal');
}
}
Target the first table and join over the common field.
DELETE FROM term_node USING term_node INNER JOIN term_data on term_data.tid = term_node.tid WHERE term_node.nid = %d AND term_data.vid = %d;
On drupals administer pages, like a system settings form or a custom form, you can add a format on a per field base so tinyMCe editor will be triggered. Usually we can use
$form['form'] = filter_form(2);
But what if you have multiple textarea fields on one page? In this case we need a reference for the format, so that drupal Fapi knows which format needs to be triggered for which field. This is done by adding the parents for the desired field on the filter_form function.
$form['fieldname']['fieldname'] = filter_form(2, NULL, 'fieldname_format');
The tricky part is that you do need to use a parent for your field with the same fieldname as you would normally do. So
$form['fieldname'] = array( ...);// becomes$form['fieldname']['fieldname'] = array( ...);
For a more detailed explanation and a couple of examples, visit http://drupal.org/node/358316.
Sometimes it can be handy to have a generic way to handle types of forms. Altering fields could be done by hook_form_alter but this could lead to messy code.
/**
* Implementation of callback_configuration().
*/
function news_configuration() {
$form_id = 'node_type_form'; module_load_include('inc', 'node', 'content_types');
$type = node_get_types('type', 'news');
$alter = array('site_conf_alter' => array(0 => 'news_rating'));
return drupal_get_form($form_id, $type, $alter);
}
/**
* Implementation of callback_form_alter().
*/
function news_configuration_form_alter(&$form) {
foreach (element_children($form) as $key) {
if ($key != 'form_id' && $key != 'form_token' && $key != 'form_build_id' && $key != 'delete')
$form[$key]['#access'] = FALSE;
}
$form['fivestar']['#access'] = TRUE;
$form['fivestar']['#collapsible'] = FALSE;
$form['submit']['#access'] = TRUE;
$form['#submit'][] = 'news_configuration_submit';
}
In general, disabled fields are not submitted or submitted with an
empty value. In drupal, we can use the form attributes or the property
disabled. See http://api.drupal.org/api/file/developer/topics/forms_api_reference.html/6 for forms_api reference guide.
Examples :
$form['fieldname']['#disabled'] = TRUE;
$form['fieldname']['attributes'] = array('disabled' => TRUE);