function theme_views_bulk_operations_fields_action_form in Views Bulk Operations (VBO) 6
Same name and namespace in other branches
- 6.3 fields.action.inc \theme_views_bulk_operations_fields_action_form()
File
- actions/
fields.action.inc, line 285 - Drupal action to set individual field values.
Code
function theme_views_bulk_operations_fields_action_form($form) {
$output = '';
if (module_exists('token') && !empty($form['#settings']['show_tokens'])) {
$output .= t('<h3>Using tokens</h3>
In text fields, you can use the following tokens:
<fieldset class="collapsed collapsible"><legend>Available tokens</legend>!tokens</fieldset>', array(
'!tokens' => theme('token_help', 'node'),
));
drupal_add_js('misc/collapse.js');
}
$access = user_access('Use PHP input for field settings (dangerous - grant with care)');
if ($access && $form['#settings']['php_code']) {
$output .= t('<h3>Using the Code widget</h3>
<ul>
<li>Will override the value specified in the Field widget.</li>
<li>Should include <?php ?> delimiters.</li>
<li>If in doubt, refer to <a target="_blank" href="@link_devel">devel.module</a> \'Dev load\' tab on a content page to figure out the expected format.</li>
<li>The variables <code>$node</code> and <code>$context</code> are available to the script.</li>
</ul>', array(
'@link_devel' => 'http://www.drupal.org/project/devel',
));
}
if (count($form['#field_info']) == 1) {
// Special case for just one field: make the table more usable
$field_name = key($form['#field_info']);
$header = array();
if ($form[$field_name . '_add']['#type'] == 'checkbox') {
$row[] = drupal_render($form[$field_name . '_add']);
$header[] = array(
'data' => t('Add?'),
'title' => t('Checkboxes in this column allow you to add new values to multi-valued fields, instead of overwriting existing values.'),
);
}
$row[] = drupal_render($form[$field_name]);
$header[] = t('Field');
if ($access && $form['#settings']['php_code']) {
$row[] = drupal_render($form[$field_name . '_code']);
$header[] = t('Code');
}
if (count($header) == 1) {
$header = NULL;
}
$output .= theme('table', $header, array(
array(
'class' => 'fields-action-row',
'id' => 'fields-action-row' . str_replace('_', '-', $field_name),
'data' => $row,
),
));
}
else {
// Many fields
drupal_add_js(drupal_get_path('module', 'views_bulk_operations') . '/js/fields.action.js');
$header = array(
t('Select'),
array(
'data' => t('Add?'),
'title' => t('Checkboxes in this column allow you to add new values to multi-valued fields, instead of overwriting existing values.'),
),
t('Field'),
);
if ($access && $form['#settings']['php_code']) {
$header[] = t('Code');
}
if (!empty($form['#field_info'])) {
foreach ($form['#field_info'] as $field_name => $field) {
$row = array(
'class' => 'fields-action-row',
'id' => 'fields-action-row-' . str_replace('_', '-', $field_name),
'data' => array(
drupal_render($form[$field_name . '_check']),
drupal_render($form[$field_name . '_add']),
drupal_render($form[$field_name]),
),
);
if ($access && $form['#settings']['php_code']) {
$row['data'][] = drupal_render($form[$field_name . '_code']);
}
$rows[] = $row;
}
}
$output .= theme('table', $header, $rows);
}
$output .= drupal_render($form);
return $output;
}