Drupal: Pass ids as arguments to page VBO action

×

Error message

  • Deprecated function: Return type of DatabaseStatementBase::execute($args = [], $options = []) should either be compatible with PDOStatement::execute(?array $params = null): bool, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in require_once() (line 2244 of /var/www/html/drupaldeveloper.in/includes/database/database.inc).
  • Deprecated function: Return type of DatabaseStatementEmpty::current() should either be compatible with Iterator::current(): mixed, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in require_once() (line 2346 of /var/www/html/drupaldeveloper.in/includes/database/database.inc).
  • Deprecated function: Return type of DatabaseStatementEmpty::next() should either be compatible with Iterator::next(): void, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in require_once() (line 2346 of /var/www/html/drupaldeveloper.in/includes/database/database.inc).
  • Deprecated function: Return type of DatabaseStatementEmpty::key() should either be compatible with Iterator::key(): mixed, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in require_once() (line 2346 of /var/www/html/drupaldeveloper.in/includes/database/database.inc).
  • Deprecated function: Return type of DatabaseStatementEmpty::valid() should either be compatible with Iterator::valid(): bool, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in require_once() (line 2346 of /var/www/html/drupaldeveloper.in/includes/database/database.inc).
  • Deprecated function: Return type of DatabaseStatementEmpty::rewind() should either be compatible with Iterator::rewind(): void, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in require_once() (line 2346 of /var/www/html/drupaldeveloper.in/includes/database/database.inc).
  • Deprecated function: Return type of DatabaseCondition::count() should either be compatible with Countable::count(): int, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in require_once() (line 1652 of /var/www/html/drupaldeveloper.in/includes/database/query.inc).
  • Deprecated function: Creation of dynamic property MergeQuery::$condition is deprecated in MergeQuery->__construct() (line 1344 of /var/www/html/drupaldeveloper.in/includes/database/query.inc).
  • Deprecated function: Creation of dynamic property DatabaseCondition::$stringVersion is deprecated in DatabaseCondition->compile() (line 1865 of /var/www/html/drupaldeveloper.in/includes/database/query.inc).
  • Deprecated function: Creation of dynamic property DatabaseCondition::$stringVersion is deprecated in DatabaseCondition->compile() (line 1865 of /var/www/html/drupaldeveloper.in/includes/database/query.inc).
  • Deprecated function: Creation of dynamic property DatabaseCondition::$stringVersion is deprecated in DatabaseCondition->compile() (line 1865 of /var/www/html/drupaldeveloper.in/includes/database/query.inc).
  • Deprecated function: Creation of dynamic property DatabaseCondition::$stringVersion is deprecated in DatabaseCondition->compile() (line 1865 of /var/www/html/drupaldeveloper.in/includes/database/query.inc).

This CodeLet add already implemented "Pass ids as arguments to page" on VBO.
Place this CodeLet to your custom module, you can see the customization on Bulk Operations field on the image.

Views Bulk Operations add another Pass ids as arguments to page
CodeLet: 

<?php
/**
* Implementation of hook_action_info
* @return multitype:multitype:string boolean The
*/

function mymodule_action_info() {
return array(
'mymodule_passid_to_other_page' => array( // declare the function name to be used. Replace the name with your function name
'type' => 'entity', // can be node,comment etc
'label' => t('Pass ids as arguments to page (Custom)'), // the name of the operation which is displayed to the user.
'aggregate' => TRUE,
'configurable' => FALSE,
'hooks' => array(),
'triggers' => array('any'),
),
);
}

/**
* Implementation of a Drupal action.
* Passes selected ids as arguments to a view.
*/
function mymodule_passid_to_other_page($entities, $context = array()) {
$base_url = $context['settings']['url'];
$arguments = implode(',', array_keys($entities));
// Add a trailing slash if missing.
if (substr($base_url, -1, 1) != '/') {
$base_url .= '/';
}
drupal_goto($base_url . $arguments);
}

/**
* mymodule_passid_to_other_page_views_bulk_operations_form
* @param unknown $options
* @return multitype:string The Ambigous
*/
function mymodule_passid_to_other_page_views_bulk_operations_form($options) {
$form['url'] = array(
'#title' => t('URL'),
'#type' => 'textfield',
'#description' => t('Enter a URL that the user will be sent to. A comma-separated list of selected ids will be appended.'),
'#default_value' => isset($options['url']) ? $options['url'] : '',
'#field_prefix' => url(NULL, array('absolute' => TRUE)) . (variable_get('clean_url', 0) ? '' : '?q='),
);
return $form;
}
?>

Compatibility: 
Is CodeLet useful?: 
Drupal: Pass ids as arguments to page VBO action | Drupal Developer

Error

The website encountered an unexpected error. Please try again later.