updated webform, webform_localization, profile2, term_merge, search_api_saved_pages, rules, redirect, overide_node_options
This commit is contained in:
@@ -58,9 +58,9 @@ function views_bulk_operations_move_to_book_action_submit($form, $form_state) {
|
||||
function views_bulk_operations_move_to_book_action($node, $context = array()) {
|
||||
if (isset($context['book'])) {
|
||||
$book_node = node_load($context['book']);
|
||||
$mlid = db_select('menu_links' , 'ml')
|
||||
->condition('ml.link_path' , 'node/' . $node->nid)
|
||||
->fields('ml' , array('mlid'))
|
||||
$mlid = db_select('menu_links', 'ml')
|
||||
->condition('ml.link_path', 'node/' . $node->nid)
|
||||
->fields('ml', array('mlid'))
|
||||
->execute()
|
||||
->fetchField();
|
||||
$node->book['mlid'] = $mlid;
|
||||
@@ -71,9 +71,10 @@ function views_bulk_operations_move_to_book_action($node, $context = array()) {
|
||||
}
|
||||
|
||||
/**
|
||||
* Adds the action 'Remove node from a parent book'
|
||||
* Adds the action 'Remove node from a parent book'.
|
||||
*/
|
||||
function views_bulk_operations_remove_from_book_action($node, $context) {
|
||||
$book = $node->book['mlid'];
|
||||
function views_bulk_operations_remove_from_book_action($node) {
|
||||
book_node_delete($node);
|
||||
// Remove book to avoid book_node_update() from building the links again.
|
||||
unset($node->book);
|
||||
}
|
||||
|
@@ -55,7 +55,7 @@ function views_bulk_operations_modify_action($entity, $context) {
|
||||
}
|
||||
}
|
||||
|
||||
if (in_array($key, $context['append']['bundle_' . $bundle_name]) && !empty($entity->$key)) {
|
||||
if (in_array($key, $context['append']['bundle_' . $bundle_name]) && !empty($entity->{$key})) {
|
||||
$entity->{$key}[$language] = array_merge($entity->{$key}[$language], $pseudo_entity->{$key}[$language]);
|
||||
|
||||
// Check if we breached cardinality, and notify the user.
|
||||
@@ -96,24 +96,24 @@ function views_bulk_operations_modify_action($entity, $context) {
|
||||
|
||||
if (!empty($context['selected']['properties'])) {
|
||||
foreach ($context['selected']['properties'] as $key) {
|
||||
if (!$wrapper->$key->access('update')) {
|
||||
if (!$wrapper->{$key}->access('update')) {
|
||||
// No access.
|
||||
continue;
|
||||
}
|
||||
|
||||
if (in_array($key, $context['append']['properties'])) {
|
||||
$old_values = $wrapper->$key->value();
|
||||
$wrapper->$key->set($context['properties'][$key]);
|
||||
$old_values = $wrapper->{$key}->value();
|
||||
$wrapper->{$key}->set($context['properties'][$key]);
|
||||
$new_values = $wrapper->{$key}->value();
|
||||
$all_values = array_merge($old_values, $new_values);
|
||||
$wrapper->$key->set($all_values);
|
||||
$wrapper->{$key}->set($all_values);
|
||||
}
|
||||
else {
|
||||
$value = $context['properties'][$key];
|
||||
if (is_string($value)) {
|
||||
$value = token_replace($value, array($context['entity_type'] => $entity), array('sanitize' => FALSE));
|
||||
}
|
||||
$wrapper->$key->set($value);
|
||||
$wrapper->{$key}->set($value);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -193,9 +193,9 @@ function views_bulk_operations_modify_action_form($context, &$form_state) {
|
||||
$form['properties'][$key]['#maxlength'] = 255;
|
||||
}
|
||||
|
||||
if (!empty($property['options list'])) {
|
||||
if (!empty($property['options list']) && is_callable($property['options list'])) {
|
||||
$form['properties'][$key]['#type'] = 'select';
|
||||
$form['properties'][$key]['#options'] = $property['options list']($key, array());
|
||||
$form['properties'][$key]['#options'] = call_user_func_array($property['options list'], array($key, array()));
|
||||
|
||||
if ($property['type'] == 'list') {
|
||||
$form['properties'][$key]['#type'] = 'checkboxes';
|
||||
@@ -405,7 +405,7 @@ function views_bulk_operations_modify_action_validate($form, &$form_state) {
|
||||
$properties = _views_bulk_operations_modify_action_get_properties($form_state['entity_type']);
|
||||
foreach ($form_state['selected']['properties'] as $key) {
|
||||
$value = $form_state['values']['properties'][$key];
|
||||
if (!$wrapper->$key->validate($value)) {
|
||||
if (!$wrapper->{$key}->validate($value)) {
|
||||
$label = $properties[$key]['label'];
|
||||
form_set_error('properties][' . $key, t('%label contains an invalid value.', array('%label' => $label)));
|
||||
}
|
||||
|
@@ -3,9 +3,8 @@ description = Provides permission-based access control for actions. Used by View
|
||||
package = Administration
|
||||
core = 7.x
|
||||
|
||||
; Information added by Drupal.org packaging script on 2017-02-21
|
||||
version = "7.x-3.4"
|
||||
; Information added by Drupal.org packaging script on 2018-05-08
|
||||
version = "7.x-3.5"
|
||||
core = "7.x"
|
||||
project = "views_bulk_operations"
|
||||
datestamp = "1487698687"
|
||||
|
||||
datestamp = "1525821486"
|
||||
|
@@ -38,9 +38,9 @@
|
||||
|
||||
$('.vbo-table-select-all', form).show();
|
||||
// This is the "select all" checkbox in (each) table header.
|
||||
$('.vbo-table-select-all', form).click(function() {
|
||||
var table = $(this).closest('table')[0];
|
||||
$('input[id^="edit-views-bulk-operations"]:not(:disabled)', table).prop('checked', this.checked);
|
||||
$('input.vbo-table-select-all', form).click(function() {
|
||||
var table = $(this).closest('table:not(.sticky-header)')[0];
|
||||
$('.vbo-select:not(:disabled)', table).prop('checked', this.checked);
|
||||
Drupal.vbo.toggleButtonsState(form);
|
||||
|
||||
// Toggle the visibility of the "select all" row (if any).
|
||||
@@ -57,17 +57,13 @@
|
||||
// Set up the ability to click anywhere on the row to select it.
|
||||
if (Drupal.settings.vbo.row_clickable) {
|
||||
$('.views-table tbody tr', form).click(function(event) {
|
||||
if (event.target.tagName.toLowerCase() != 'input' && event.target.tagName.toLowerCase() != 'a') {
|
||||
$('input[id^="edit-views-bulk-operations"]:not(:disabled)', this).each(function() {
|
||||
var checked = this.checked;
|
||||
// trigger() toggles the checkmark *after* the event is set,
|
||||
// whereas manually clicking the checkbox toggles it *beforehand*.
|
||||
// that's why we manually set the checkmark first, then trigger the
|
||||
// event (so that listeners get notified), then re-set the checkmark
|
||||
// which the trigger will have toggled. yuck!
|
||||
this.checked = !checked;
|
||||
$(this).trigger('click');
|
||||
this.checked = !checked;
|
||||
var tagName = event.target.tagName.toLowerCase();
|
||||
if (tagName != 'input' && tagName != 'a' && tagName != 'label') {
|
||||
$('.vbo-select:not(:disabled)', this).each(function() {
|
||||
// Always return true for radios, you cannot de-select a radio by clicking on it,
|
||||
// it should be the same when clicking on a row.
|
||||
this.checked = $(this).is(':radio') ? true : !this.checked;
|
||||
$(this).trigger('change');
|
||||
});
|
||||
}
|
||||
});
|
||||
@@ -92,7 +88,7 @@
|
||||
$('.vbo-select-all-markup', form).show();
|
||||
|
||||
$('.vbo-select-this-page', form).click(function() {
|
||||
$('input[id^="edit-views-bulk-operations"]', form).prop('checked', this.checked);
|
||||
$('.vbo-select', form).prop('checked', this.checked);
|
||||
Drupal.vbo.toggleButtonsState(form);
|
||||
$('.vbo-select-all-pages', form).prop('checked', false);
|
||||
|
||||
@@ -100,7 +96,7 @@
|
||||
$('.vbo-table-select-all', form).prop('checked', this.checked);
|
||||
});
|
||||
$('.vbo-select-all-pages', form).click(function() {
|
||||
$('input[id^="edit-views-bulk-operations"]', form).prop('checked', this.checked);
|
||||
$('.vbo-select', form).prop('checked', this.checked);
|
||||
Drupal.vbo.toggleButtonsState(form);
|
||||
$('.vbo-select-this-page', form).prop('checked', false);
|
||||
|
||||
@@ -117,7 +113,8 @@
|
||||
Drupal.vbo.toggleButtonsState(form);
|
||||
});
|
||||
|
||||
$('.vbo-select', form).click(function() {
|
||||
// Handle a "change" event originating either from a row click or an actual checkbox click.
|
||||
$('.vbo-select', form).change(function() {
|
||||
// If a checkbox was deselected, uncheck any "select all" checkboxes.
|
||||
if (!this.checked) {
|
||||
$('.vbo-select-this-page', form).prop('checked', false);
|
||||
@@ -147,7 +144,9 @@
|
||||
// If no rows are checked, disable any form submit actions.
|
||||
var selectbox = $('select[name="operation"]', form);
|
||||
var checkedCheckboxes = $('.vbo-select:checked', form);
|
||||
var buttons = $('[id^="edit-select"] input[type="submit"]', form);
|
||||
// The .vbo-prevent-toggle CSS class is added to buttons to prevent toggling
|
||||
// between disabled and enabled. For example the case of an 'add' button.
|
||||
var buttons = $('[id^="edit-select"] [type="submit"]:not(.vbo-prevent-toggle)', form);
|
||||
|
||||
if (selectbox.length) {
|
||||
var has_selection = checkedCheckboxes.length && selectbox.val() !== '0';
|
||||
|
@@ -128,7 +128,12 @@ class ViewsBulkOperationsAction extends ViewsBulkOperationsBaseOperation {
|
||||
actions_list();
|
||||
|
||||
$submit_callback = $this->operationInfo['callback'] . '_submit';
|
||||
$this->formOptions = $submit_callback($form, $form_state);
|
||||
// If the return value from the callback is an options array, store it for
|
||||
// later union onto the context.
|
||||
$options = $submit_callback($form, $form_state);
|
||||
if ($options && is_array($options)) {
|
||||
$this->formOptions = $options;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
@@ -285,6 +285,7 @@ class views_bulk_operations_handler_field_operations extends views_handler_field
|
||||
'#type' => 'radio',
|
||||
'#parents' => array($this->options['id']),
|
||||
'#return_value' => $id,
|
||||
'#attributes' => array('class' => array('vbo-select')),
|
||||
);
|
||||
}
|
||||
else {
|
||||
|
@@ -9,9 +9,8 @@ php = 5.2.9
|
||||
files[] = plugins/operation_types/base.class.php
|
||||
files[] = views/views_bulk_operations_handler_field_operations.inc
|
||||
|
||||
; Information added by Drupal.org packaging script on 2017-02-21
|
||||
version = "7.x-3.4"
|
||||
; Information added by Drupal.org packaging script on 2018-05-08
|
||||
version = "7.x-3.5"
|
||||
core = "7.x"
|
||||
project = "views_bulk_operations"
|
||||
datestamp = "1487698687"
|
||||
|
||||
datestamp = "1525821486"
|
||||
|
@@ -13,6 +13,7 @@ define('VBO_ACCESS_OP_DELETE', 0x08);
|
||||
|
||||
/**
|
||||
* Implements hook_action_info().
|
||||
*
|
||||
* Registers custom VBO actions as Drupal actions.
|
||||
*/
|
||||
function views_bulk_operations_action_info() {
|
||||
@@ -20,9 +21,14 @@ function views_bulk_operations_action_info() {
|
||||
$files = views_bulk_operations_load_action_includes();
|
||||
foreach ($files as $filename) {
|
||||
$action_info_fn = 'views_bulk_operations_'. str_replace('.', '_', basename($filename, '.inc')).'_info';
|
||||
$action_info = call_user_func($action_info_fn);
|
||||
if (is_array($action_info)) {
|
||||
$actions += $action_info;
|
||||
if (is_callable($action_info_fn)) {
|
||||
$action_info = call_user_func($action_info_fn);
|
||||
if (is_array($action_info)) {
|
||||
$actions += $action_info;
|
||||
}
|
||||
}
|
||||
else {
|
||||
watchdog('views bulk operations', 'views_bulk_operations_action_info() expects action filenames to have a matching valid callback function named: %function', array('%function' => $action_info_fn), WATCHDOG_WARNING);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -190,7 +196,7 @@ function views_bulk_operations_get_operation_info($operation_id = NULL) {
|
||||
$operations += $plugin['list callback']();
|
||||
}
|
||||
|
||||
uasort($operations, create_function('$a, $b', 'return strcasecmp($a["label"], $b["label"]);'));
|
||||
uasort($operations, '_views_bulk_operations_sort_operations_by_label');
|
||||
}
|
||||
|
||||
if (!empty($operation_id)) {
|
||||
@@ -201,6 +207,16 @@ function views_bulk_operations_get_operation_info($operation_id = NULL) {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Sort function used by uasort in views_bulk_operations_get_operation_info().
|
||||
*
|
||||
* A closure would be better suited for this, but closure support was added in
|
||||
* PHP 5.3 and D7 supports 5.2.
|
||||
*/
|
||||
function _views_bulk_operations_sort_operations_by_label($a, $b) {
|
||||
return strcasecmp($a['label'], $b['label']);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns an operation instance.
|
||||
*
|
||||
@@ -523,7 +539,7 @@ function views_bulk_operations_form($form, &$form_state, $vbo) {
|
||||
$enable_select_all_pages = FALSE;
|
||||
// If the view is paginated, and "select all items on all pages" is
|
||||
// enabled, tell that to the theme function.
|
||||
if (count($vbo->view->result) != $vbo->view->total_rows && $vbo->get_vbo_option('enable_select_all_pages')) {
|
||||
if (isset($vbo->view->total_rows) && count($vbo->view->result) != $vbo->view->total_rows && $vbo->get_vbo_option('enable_select_all_pages')) {
|
||||
$enable_select_all_pages = TRUE;
|
||||
}
|
||||
$form['select_all_markup'] = array(
|
||||
@@ -842,7 +858,7 @@ function views_bulk_operations_execute($vbo, $operation, $selection, $select_all
|
||||
|
||||
// All items on all pages should be selected, add a batch job to gather
|
||||
// and enqueue them.
|
||||
if ($select_all_pages && $vbo->view->query->pager->has_more_records()) {
|
||||
if ($select_all_pages && ($vbo->view->query->pager->has_more_records() || $vbo->view->query->pager->get_current_page() > 0)) {
|
||||
$total_rows = $vbo->view->total_rows;
|
||||
|
||||
$batch['operations'][] = array(
|
||||
@@ -1186,7 +1202,7 @@ function views_bulk_operations_direct_process($operation, $rows, $options) {
|
||||
$skip_permission_check = $operation->getAdminOption('skip_permission_check');
|
||||
// Filter out entities that can't be accessed.
|
||||
foreach ($entities as $id => $entity) {
|
||||
if (!$skip_permission_check && !_views_bulk_operations_entity_access($operation, $entity_type, $entity, $account)) {
|
||||
if (!$skip_permission_check && !_views_bulk_operations_entity_access($operation, $entity_type, $entity, $user)) {
|
||||
$context['results']['log'][] = t('Skipped %operation on @type %title due to insufficient permissions.', array(
|
||||
'%operation' => $operation->label(),
|
||||
'@type' => $entity_type,
|
||||
|
@@ -173,7 +173,11 @@ function views_bulk_operations_action_load_list($view, $args) {
|
||||
$entity_type = $vbo->get_entity_type();
|
||||
$entities = entity_metadata_wrapper("list<$entity_type>", array());
|
||||
foreach ($vbo->view->result as $row_index => $result) {
|
||||
$entities[] = entity_metadata_wrapper($entity_type, $vbo->get_value($result));
|
||||
// Grab the entire entity if it's already loaded or fall back to the
|
||||
// entity identifier.
|
||||
$entity = $vbo->get_value($result);
|
||||
$data = $entity ? $entity : $result->{$vbo->real_field};
|
||||
$entities[] = entity_metadata_wrapper($entity_type, $data);
|
||||
}
|
||||
|
||||
return array('entity_list' => $entities);
|
||||
|
Reference in New Issue
Block a user