updated contrib modules

This commit is contained in:
Bachir Soussi Chiadmi
2018-03-13 14:16:18 +01:00
parent e668535a4e
commit 272fa07ccf
202 changed files with 5165 additions and 1725 deletions
@@ -0,0 +1,29 @@
Introduction
------------
Views Bulk Edit allows modifying field values of a selected list of entities
of any type. It works with Views Bulk Operations (VBO) module, offering all of its
benefits like batching, ability to select all view results or persistent
selection across pages.
Requirements
------------
Views Bulk Edit requires Views Bulk operations module to be installed.
Installation
------------
Install as any other Drupal 8 module.
Configuration
-------------
1. Create or edit any view, the most convenient display type for end
user in case of VBO views is Table.
2. Add a "Views bulk operations" field (global), available on
all entity types, if not already added.
3. Check the "Modify field values" action.
@@ -2,7 +2,16 @@
"name": "drupal/views_bulk_edit",
"type": "drupal-module",
"description": "Allows bulk edition of entity field values.",
"homepage": "http://drupal.org/project/views_bulk_edit",
"homepage": "https://www.drupal.org/project/views_bulk_edit",
"authors": [
{
"name": "Marcin Grabias",
"homepage": "https://www.drupal.org/u/graber"
}
],
"support": {
"issues": "https://www.drupal.org/project/issues/views_bulk_edit?version=8.x"
},
"license": "GPL-2.0+",
"require": {
"drupal/views_bulk_operations": "~1.0 | ~2.0"
@@ -52,6 +52,8 @@ class ModifyEntityValues extends ViewsBulkOperationsActionBase implements Contai
* Entity type manager.
* @param \Drupal\Core\Entity\EntityTypeBundleInfoInterface $bundleInfo
* Bundle info object.
* @param \Drupal\Core\Database\Connection $database
* Database conection.
*/
public function __construct(array $configuration, $plugin_id, $plugin_definition, ViewsbulkOperationsViewData $viewDataService, ViewsBulkOperationsActionProcessor $actionProcessor, EntityTypeManagerInterface $entityTypeManager, EntityTypeBundleInfoInterface $bundleInfo, Connection $database) {
parent::__construct($configuration, $plugin_id, $plugin_definition);
@@ -290,6 +292,8 @@ class ModifyEntityValues extends ViewsBulkOperationsActionBase implements Contai
* Given an entity form, create a selector form to provide options to update
* values.
*
* @param string $entity_type_id
* Entity type ID.
* @param string $bundle
* The bundle machine name.
* @param array $form
@@ -0,0 +1,158 @@
<?php
namespace Drupal\Tests\views_bulk_edit\Functional;
use Drupal\Tests\BrowserTestBase;
use Drupal\node\NodeInterface;
/**
* @coversDefaultClass \Drupal\views_bulk_edit\Plugin\Action\ModifyEntityValues
* @group views_bulk_edit
*/
class ViewsBulkEditModifyEntityValuesTest extends BrowserTestBase {
/**
* Modules to install.
*
* @var array
*/
public static $modules = [
'node',
'views',
'views_bulk_operations',
'views_bulk_operations_test',
'views_bulk_edit',
];
/**
* {@inheritdoc}
*/
protected function setUp() {
parent::setUp();
// Create some nodes for testing.
$this->createContentType(['type' => 'article', 'name' => 'Article']);
$this->createContentType(['type' => 'page', 'name' => 'Page']);
// Create a text field on the page content type.
$entityTypeManager = $this->container->get('entity_type.manager');
$entityTypeManager->getStorage('field_storage_config')->create([
'field_name' => 'text',
'entity_type' => 'node',
'type' => 'text',
'module' => 'text',
'cardinality' => 1,
])->save();
$entityTypeManager->getStorage('field_config')->create([
'field_name' => 'text',
'entity_type' => 'node',
'bundle' => 'page',
'label' => 'Field text',
])->save();
$entityTypeManager->getStorage('entity_form_display')->load('node.page.default')->setComponent('text', [
'type' => 'text_textfield',
'region' => 'content',
'settings' => [
'size' => 10,
],
])->save();
$this->testNodes = [];
$time = REQUEST_TIME;
for ($i = 0; $i < 4; $i++) {
// Ensure nodes are sorted in the same order they are inserted in the
// array.
$time -= $i;
$type = ($i % 2 == 0) ? 'article' : 'page';
$this->testNodes[] = $this->drupalCreateNode([
// Bundles will be: page, article, page, article.
'type' => $type,
'title' => 'Title ' . $i . ' (' . $type . ')',
'sticky' => FALSE,
'created' => $time,
'changed' => $time,
]);
}
}
/**
* Test the bulk edit operation.
*/
public function testViewsBulkEdit() {
// Log in as a user with 'edit any page content' permission
// to have access to perform the test operation.
$admin_user = $this->drupalCreateUser([
'administer nodes',
'bypass node access',
'execute advanced test action',
]);
$this->drupalLogin($admin_user);
// Modify config of the test view: add the views_bulk_edit operation,
// set items per page to 10 and offset to 0.
$testViewConfig = $this->container->get('config.factory')->getEditable('views.view.views_bulk_operations_test_advanced');
$configData = $testViewConfig->getRawData();
$configData['display']['default']['display_options']['fields']['views_bulk_operations_bulk_form']['selected_actions']['views_bulk_edit'] = 'views_bulk_edit';
$configData['display']['default']['display_options']['fields']['views_bulk_operations_bulk_form']['preconfiguration']['views_bulk_edit'] = ['label_override' => ''];
$configData['display']['default']['display_options']['pager']['options']['items_per_page'] = 10;
$configData['display']['default']['display_options']['pager']['options']['offset'] = 0;
$testViewConfig->setData($configData);
$testViewConfig->save();
// Post the VBO form with one page and one article selected.
$edit = [
'action' => 'views_bulk_edit',
'views_bulk_operations_bulk_form[1]' => TRUE,
'views_bulk_operations_bulk_form[2]' => TRUE,
];
$this->drupalPostForm('views-bulk-operations-test-advanced', $edit, t('Apply to selected items'));
// Post the configuration form: modify status and text value field on the
// article content type.
$expected_text_value = 'some text';
$this->drupalPostForm(NULL, [
'node[article][_field_selector][status]' => TRUE,
'node[article][status][value]' => FALSE,
'node[page][_field_selector][status]' => TRUE,
'node[page][status][value]' => FALSE,
'node[page][_field_selector][text]' => TRUE,
'node[page][text][0][value]' => $expected_text_value,
], t('Apply'));
// Assert if field values have been changed on the selected entities
// and unchanged otherwise.
$nodeStorage = $this->container->get('entity_type.manager')->getStorage('node');
foreach ($this->testNodes as $index => $node) {
// Reload the node.
$node = $nodeStorage->load($node->id());
$status = intval($node->status->value);
$text = isset($node->text) ? $node->text->value : FALSE;
switch ($index) {
case 0:
$this->assertEquals(NodeInterface::PUBLISHED, $status);
$this->assertEquals(FALSE, $text);
break;
case 1:
$this->assertEquals(NodeInterface::NOT_PUBLISHED, $status);
$this->assertEquals($expected_text_value, $text);
break;
case 2:
$this->assertEquals(NodeInterface::NOT_PUBLISHED, $status);
$this->assertEquals(FALSE, $text);
break;
case 3:
$this->assertEquals(NodeInterface::PUBLISHED, $status);
$this->assertEquals('', $text);
break;
}
}
}
}
@@ -0,0 +1,79 @@
<?php
namespace Drupal\Tests\views_bulk_edit\Kernel;
use Drupal\Tests\views_bulk_operations\Kernel\ViewsBulkOperationsKernelTestBase;
use Drupal\node\NodeInterface;
/**
* @coversDefaultClass \Drupal\views_bulk_edit\Plugin\Action\ModifyEntityValues
* @group views_bulk_edit
*/
class ViewsBulkEditActionTest extends ViewsBulkOperationsKernelTestBase {
/**
* {@inheritdoc}
*/
public static $modules = [
'views_bulk_edit',
];
/**
* {@inheritdoc}
*/
public function setUp() {
parent::setUp();
$this->createTestNodes([
'page' => [
'count' => 10,
],
]);
}
/**
* Tests the bulk edit action.
*
* @covers ::getViewBundles
* @covers ::execute
*/
public function testModifyEntityValues() {
$vbo_data = [
'view_id' => 'views_bulk_operations_test',
'action_id' => 'views_bulk_edit',
'configuration' => [
'node' => [
'page' => [
'status' => [
['value' => 0],
],
],
],
],
];
// Get list of rows to process from different view pages.
$selection = [0, 3, 6, 8];
$vbo_data['list'] = $this->getResultsList($vbo_data, $selection);
// Execute the action.
$results = $this->executeAction($vbo_data);
$nodeStorage = $this->container->get('entity_type.manager')->getStorage('node');
$statuses = [];
foreach ($this->testNodesData as $id => $lang_data) {
$node = $nodeStorage->load($id);
$status = intval($node->status->value);
foreach ($vbo_data['list'] as $item) {
if ($item[3] == $id) {
$this->assertEquals(NodeInterface::NOT_PUBLISHED, $status);
break 2;
}
}
$this->assertEquals(NodeInterface::PUBLISHED, $status);
}
}
}
@@ -6,8 +6,8 @@ package: 'Views Bulk Operations'
dependencies:
- drupal:views_bulk_operations
# Information added by Drupal.org packaging script on 2018-02-06
version: '8.x-2.0-beta4'
# Information added by Drupal.org packaging script on 2018-03-12
version: '8.x-2.0-rc1'
core: '8.x'
project: 'views_bulk_edit'
datestamp: 1517947086
datestamp: 1520840585
@@ -0,0 +1,24 @@
<?php
/**
* @file
* Allows modification of field values of entities selected in a view.
*/
use Drupal\Core\Routing\RouteMatchInterface;
/**
* Implements hook_help().
*/
function views_bulk_edit_help($route_name, RouteMatchInterface $route_match) {
switch ($route_name) {
case 'help.page.views_bulk_edit':
$filepath = dirname(__FILE__) . '/README.txt';
if (file_exists($filepath)) {
$readme = file_get_contents($filepath);
$output = '<pre>' . $readme . '</pre>';
return $output;
}
}
}
@@ -6,8 +6,8 @@ package: 'Views Bulk Operations'
dependencies:
- drupal:views_bulk_operations
# Information added by Drupal.org packaging script on 2018-02-08
version: '8.x-2.0-rc4+1-dev'
# Information added by Drupal.org packaging script on 2018-03-10
version: '8.x-2.1'
core: '8.x'
project: 'views_bulk_operations'
datestamp: 1518076986
datestamp: 1520668088
@@ -6,8 +6,8 @@ package: 'Examples'
dependencies:
- drupal:views_bulk_operations
# Information added by Drupal.org packaging script on 2018-02-08
version: '8.x-2.0-rc4+1-dev'
# Information added by Drupal.org packaging script on 2018-03-10
version: '8.x-2.1'
core: '8.x'
project: 'views_bulk_operations'
datestamp: 1518076986
datestamp: 1520668088
@@ -0,0 +1,89 @@
<?php
namespace Drupal\Tests\views_bulk_operations\Kernel;
use Drupal\node\NodeInterface;
/**
* @coversDefaultClass \Drupal\views_bulk_operations\Service\ViewsBulkOperationsActionProcessor
* @group views_bulk_operations
*/
class ViewsBulkOperationsActionProcessorTest extends ViewsBulkOperationsKernelTestBase {
/**
* {@inheritdoc}
*/
public function setUp() {
parent::setUp();
$this->createTestNodes([
'page' => [
'count' => 20,
],
]);
}
/**
* Tests general functionality of ViewsBulkOperationsActionProcessor.
*
* @covers ::getPageList
* @covers ::populateQueue
* @covers ::process
*/
public function testViewsbulkOperationsActionProcessor() {
$vbo_data = [
'view_id' => 'views_bulk_operations_test',
'action_id' => 'views_bulk_operations_simple_test_action',
'configuration' => [
'preconfig' => 'test',
],
];
// Test executing all view results first.
$results = $this->executeAction($vbo_data);
// The default batch size is 10 and there are 20 result rows total
// (10 nodes, each having a translation), check messages:
$this->assertEquals('Processed 10 of 20 entities.', $results['messages'][0]);
$this->assertEquals('Processed 20 of 20 entities.', $results['messages'][1]);
$this->assertEquals(20, $results['operations']['Test']);
// For a more advanced test, check if randomly selected entities
// have been unpublished.
$vbo_data = [
'view_id' => 'views_bulk_operations_test',
'action_id' => 'views_bulk_operations_advanced_test_action',
'preconfiguration' => [
'test_preconfig' => 'test',
'test_config' => 'unpublish',
],
];
// Get list of rows to process from different view pages.
$selection = [0, 3, 6, 8, 15, 16, 18];
$vbo_data['list'] = $this->getResultsList($vbo_data, $selection);
// Execute the action.
$results = $this->executeAction($vbo_data);
$nodeStorage = $this->container->get('entity_type.manager')->getStorage('node');
$statuses = [];
foreach ($this->testNodesData as $id => $lang_data) {
$node = $nodeStorage->load($id);
$statuses[$id] = intval($node->status->value);
}
foreach ($statuses as $id => $status) {
foreach ($vbo_data['list'] as $item) {
if ($item[3] == $id) {
$this->assertEquals(NodeInterface::NOT_PUBLISHED, $status);
break 2;
}
}
$this->assertEquals(NodeInterface::PUBLISHED, $status);
}
}
}
@@ -2,62 +2,13 @@
namespace Drupal\Tests\views_bulk_operations\Kernel;
use Drupal\KernelTests\KernelTestBase;
use Drupal\simpletest\NodeCreationTrait;
use Drupal\node\Entity\NodeType;
use Drupal\user\Entity\User;
use Drupal\views\Views;
use Drupal\language\Entity\ConfigurableLanguage;
/**
* @coversDefaultClass \Drupal\views_bulk_operations\Service\ViewsBulkOperationsViewData
* @group views_bulk_operations
*/
class ViewsBulkOperationsDataServiceTest extends KernelTestBase {
use NodeCreationTrait {
getNodeByTitle as drupalGetNodeByTitle;
createNode as drupalCreateNode;
}
/**
* Test nodes data.
*
* @var array
*/
protected $testNodesData;
/**
* The expected total number of view results.
*
* @var int
*/
protected $resultsCount = 0;
/**
* The tested service.
*
* @var \Drupal\views_bulk_operations\Service\ViewsbulkOperationsViewData
*/
protected $vboDataService;
/**
* {@inheritdoc}
*/
public static $modules = [
'user',
'node',
'field',
'content_translation',
'views_bulk_operations',
'views_bulk_operations_test',
'views',
'filter',
'language',
'text',
'action',
'system',
];
class ViewsBulkOperationsDataServiceTest extends ViewsBulkOperationsKernelTestBase {
/**
* {@inheritdoc}
@@ -65,71 +16,12 @@ class ViewsBulkOperationsDataServiceTest extends KernelTestBase {
public function setUp() {
parent::setUp();
$this->installEntitySchema('user');
$this->installEntitySchema('node');
$this->installSchema('node', 'node_access');
$this->installSchema('system', 'sequences');
$this->installSchema('system', 'key_value_expire');
$user = User::create();
$user->setPassword('password');
$user->enforceIsNew();
$user->setEmail('email');
$user->setUsername('user_name');
$user->save();
user_login_finalize($user);
$this->installConfig([
'system',
'filter',
'views_bulk_operations_test',
'language',
$this->createTestNodes([
'page' => [
'languages' => ['pl', 'es', 'it', 'fr', 'de'],
'count' => 20,
],
]);
$languages = ['pl', 'es', 'it', 'fr', 'de'];
$count_languages = count($languages);
for ($i = 0; $i < $count_languages; $i++) {
$language = ConfigurableLanguage::createFromLangcode($languages[$i]);
$language->save();
}
$type = NodeType::create([
'type' => 'page',
'name' => 'page',
]);
$type->save();
\Drupal::service('content_translation.manager')->setEnabled('node', 'page', TRUE);
\Drupal::entityManager()->clearCachedDefinitions();
// Create some test nodes with translations.
$this->testNodesData = [];
$time = REQUEST_TIME;
for ($i = 0; $i < 10; $i++) {
$time -= $i;
$title = 'Title ' . $i;
$node = $this->drupalCreateNode([
'type' => 'page',
'title' => $title,
'sticky' => FALSE,
'created' => $time,
'changed' => $time,
]);
$this->testNodesData[$node->id()]['en'] = $title;
$this->resultsCount++;
$langcode = $languages[rand(0, $count_languages - 1)];
$title = 'Translated title ' . $langcode . ' ' . $i;
$translation = $node->addTranslation($langcode, [
'title' => $title,
]);
$translation->save();
$this->testNodesData[$node->id()][$langcode] = $title;
$this->resultsCount++;
}
// Initialize the tested service.
$this->vboDataService = $this->container->get('views_bulk_operations.data');
}
/**
@@ -138,7 +30,6 @@ class ViewsBulkOperationsDataServiceTest extends KernelTestBase {
* @covers ::getEntityDefault
*/
public function testViewsbulkOperationsViewDataEntityGetter() {
$this->assertTrue(TRUE);
// Initialize and execute the test view with all items displayed.
$view = Views::getView('views_bulk_operations_test');
$view->setDisplay('page_1');
@@ -0,0 +1,296 @@
<?php
namespace Drupal\Tests\views_bulk_operations\Kernel;
use Drupal\KernelTests\KernelTestBase;
use Drupal\simpletest\NodeCreationTrait;
use Drupal\node\Entity\NodeType;
use Drupal\user\Entity\User;
use Drupal\views\Views;
use Drupal\language\Entity\ConfigurableLanguage;
use Drupal\views_bulk_operations\ViewsBulkOperationsBatch;
/**
* Base class for Views Bulk Operations kernel tests.
*/
abstract class ViewsBulkOperationsKernelTestBase extends KernelTestBase {
use NodeCreationTrait {
getNodeByTitle as drupalGetNodeByTitle;
createNode as drupalCreateNode;
}
// To be removed.
const TEST_NODES_COUNT = 10;
const VBO_DEFAULTS = [
'list' => [],
'display_id' => 'default',
'preconfiguration' => [],
'batch' => TRUE,
'arguments' => [],
'exposed_input' => [],
'batch_size' => 10,
'relationship_id' => 'none',
];
/**
* Test node types already created.
*
* @var array
*/
protected $testNodesTypes;
/**
* Test nodes data including titles and languages.
*
* @var array
*/
protected $testNodesData;
/**
* VBO views data service.
*
* @var \Drupal\views_bulk_operations\Service\ViewsBulkOperationsViewDataInterface
*/
protected $vboDataService;
/**
* {@inheritdoc}
*/
public static $modules = [
'user',
'node',
'field',
'content_translation',
'views_bulk_operations',
'views_bulk_operations_test',
'views',
'filter',
'language',
'text',
'action',
'system',
];
/**
* {@inheritdoc}
*/
public function setUp() {
parent::setUp();
$this->installEntitySchema('user');
$this->installEntitySchema('node');
$this->installSchema('node', 'node_access');
$this->installSchema('system', 'sequences');
$this->installSchema('system', 'key_value_expire');
$user = User::create();
$user->setPassword('password');
$user->enforceIsNew();
$user->setEmail('email');
$user->setUsername('user_name');
$user->save();
user_login_finalize($user);
$this->installConfig([
'system',
'filter',
'views_bulk_operations_test',
'language',
]);
// Get VBO view data service.
$this->vboDataService = $this->container->get('views_bulk_operations.data');
}
/**
* Create some test nodes.
*
* @param array $test_node_data
* Describes test node bundles and properties.
*
* @see Drupal\Tests\views_bulk_operations\Kernel\ViewsBulkOperationsDataServiceTest::setUp()
*/
protected function createTestNodes(array $test_node_data) {
$this->testNodesData = [];
foreach ($test_node_data as $type_name => $type_data) {
$type = NodeType::create([
'type' => $type_name,
'name' => $type_name,
]);
$type->save();
$count_languages = isset($type_data['languages']) ? count($type_data['languages']) : 0;
if ($count_languages) {
for ($i = 0; $i < $count_languages; $i++) {
$language = ConfigurableLanguage::createFromLangcode($type_data['languages'][$i]);
$language->save();
}
$this->container->get('content_translation.manager')->setEnabled('node', $type_name, TRUE);
// $this->container->get('entity_type.manager')->clearCachedDefinitions();
}
// Create some test nodes.
$time = REQUEST_TIME;
if (!isset($type_data['count'])) {
$type_data['count'] = 10;
}
for ($i = 0; $i < $type_data['count']; $i++) {
$time -= $i;
$title = 'Title ' . $i;
$node = $this->drupalCreateNode([
'type' => $type_name,
'title' => $title,
'sticky' => FALSE,
'created' => $time,
'changed' => $time,
]);
$this->testNodesData[$node->id()]['en'] = $title;
if ($count_languages) {
// It doesn't really matter to which languages we translate
// from the API point of view so some randomness should be fine.
$langcode = $type_data['languages'][rand(0, $count_languages - 1)];
$title = 'Translated title ' . $langcode . ' ' . $i;
$translation = $node->addTranslation($langcode, [
'title' => $title,
]);
$translation->save();
$this->testNodesData[$node->id()][$langcode] = $title;
}
}
}
}
/**
* Initialize and return the view described by $vbo_data.
*
* @param array $vbo_data
* An array of data passed to VBO Processor service.
*
* @return \Drupal\views\ViewExecutable
* The view object.
*/
protected function initializeView(array $vbo_data) {
if (!$view = Views::getView($vbo_data['view_id'])) {
throw new \Exception('Incorrect view ID provided.');
}
if (!$view->setDisplay($vbo_data['display_id'])) {
throw new \Exception('Incorrect view display ID provided.');
}
$view->built = FALSE;
$view->executed = FALSE;
return $view;
}
/**
* Get a random list of results bulk keys.
*
* @param array $vbo_data
* An array of data passed to VBO Processor service.
* @param array $deltas
* Array of result rows deltas.
*
* @return array
* List of results to process.
*/
protected function getResultsList(array $vbo_data, array $deltas) {
// Merge in defaults.
$vbo_data += static::VBO_DEFAULTS;
$view = $this->initializeView($vbo_data);
if (!empty($vbo_data['arguments'])) {
$view->setArguments($vbo_data['arguments']);
}
if (!empty($vbo_data['exposed_input'])) {
$view->setExposedInput($vbo_data['exposed_input']);
}
$view->setItemsPerPage(0);
$view->setCurrentPage(0);
$view->execute();
$this->vboDataService->init($view, $view->getDisplay(), $vbo_data['relationship_id']);
$list = [];
$base_field = $view->storage->get('base_field');
foreach ($deltas as $delta) {
$entity = $this->vboDataService->getEntity($view->result[$delta]);
$list[] = [
$view->result[$delta]->{$base_field},
$entity->language()->getId(),
$entity->getEntityTypeId(),
$entity->id(),
];
}
$view->destroy();
return $list;
}
/**
* Execute an action on a specific view results.
*
* @param array $vbo_data
* An array of data passed to VBO Processor service.
*/
protected function executeAction(array $vbo_data) {
// Merge in defaults.
$vbo_data += static::VBO_DEFAULTS;
$view = $this->initializeView($vbo_data);
$view->get_total_rows = TRUE;
$view->execute();
// Get total rows count.
$this->vboDataService->init($view, $view->getDisplay(), $vbo_data['relationship_id']);
$vbo_data['total_results'] = $this->vboDataService->getTotalResults();
// Get action definition and check if action ID is correct.
$action_definition = $this->container->get('plugin.manager.views_bulk_operations_action')->getDefinition($vbo_data['action_id']);
if (!isset($vbo_data['action_label'])) {
$vbo_data['action_label'] = (string) $action_definition['label'];
}
// Populate entity list if empty.
if (empty($vbo_data['list'])) {
$context = [];
do {
$context['finished'] = 1;
$context['message'] = '';
ViewsBulkOperationsBatch::getList($vbo_data, $context);
} while ($context['finished'] < 1);
$vbo_data = $context['results'];
}
$summary = [
'messages' => [],
];
// Execute the selected action.
$context = [];
do {
$context['finished'] = 1;
$context['message'] = '';
ViewsBulkOperationsBatch::operation($vbo_data, $context);
if (!empty($context['message'])) {
$summary['messages'][] = (string) $context['message'];
}
} while ($context['finished'] < 1);
// Add information to the summary array.
$summary += [
'operations' => array_count_values($context['results']['operations']),
];
return $summary;
}
}
@@ -181,7 +181,22 @@ display:
preconfig: 'Test setting'
plugin_id: views_bulk_operations_bulk_form
filters: { }
sorts: { }
sorts:
created:
id: created
table: node_field_data
field: created
relationship: none
group_type: group
admin_label: ''
order: DESC
exposed: false
expose:
label: ''
granularity: second
entity_type: node
entity_field: created
plugin_id: date
title: 'Views Bulk Operations Test'
header: { }
footer: { }
@@ -219,7 +219,22 @@ display:
entity_type: node
entity_field: status
plugin_id: boolean
sorts: { }
sorts:
created:
id: created
table: node_field_data
field: created
relationship: none
group_type: group
admin_label: ''
order: DESC
exposed: false
expose:
label: ''
granularity: second
entity_type: node
entity_field: created
plugin_id: date
title: 'Views Bulk Operations Test'
header: { }
footer: { }
@@ -46,7 +46,10 @@ class ViewsBulkOperationsAdvancedTestAction extends ViewsBulkOperationsActionBas
// Unpublish entity.
if ($this->configuration['test_config'] === 'unpublish') {
$entity->status = NODE_NOT_PUBLISHED;
if (!$entity->isDefaultTranslation()) {
$entity = \Drupal::service('entity_type.manager')->getStorage('node')->load($entity->id());
}
$entity->setPublished(FALSE);
$entity->save();
}
@@ -7,8 +7,8 @@ dependencies:
- drupal:views_bulk_operations
- drupal:node
# Information added by Drupal.org packaging script on 2018-02-08
version: '8.x-2.0-rc4+1-dev'
# Information added by Drupal.org packaging script on 2018-03-10
version: '8.x-2.1'
core: '8.x'
project: 'views_bulk_operations'
datestamp: 1518076986
datestamp: 1520668088
@@ -6,8 +6,8 @@ package: 'Views'
dependencies:
- drupal:views (>=8.4)
# Information added by Drupal.org packaging script on 2018-02-08
version: '8.x-2.0-rc4+1-dev'
# Information added by Drupal.org packaging script on 2018-03-10
version: '8.x-2.1'
core: '8.x'
project: 'views_bulk_operations'
datestamp: 1518076986
datestamp: 1520668088