From 687e69f8675069a3f64bf1880971b9e73e274211 Mon Sep 17 00:00:00 2001
From: florenttorregrosa <florenttorregrosa@2388214.no-reply.drupal.org>
Date: Mon, 26 Dec 2016 16:46:10 +0100
Subject: [PATCH] Issue #2839351 by Grimreaper: VBO for taxonomy term

---
 .../config/schema/taxonomy.views.schema.yml         |  4 ++++
 .../src/Plugin/views/field/TaxonomyTermBulkForm.php | 21 +++++++++++++++++++++
 core/modules/taxonomy/src/TermViewsData.php         |  8 ++++++++
 3 files changed, 33 insertions(+)
 create mode 100644 core/modules/taxonomy/src/Plugin/views/field/TaxonomyTermBulkForm.php

diff --git a/core/modules/taxonomy/config/schema/taxonomy.views.schema.yml b/core/modules/taxonomy/config/schema/taxonomy.views.schema.yml
index 9ec9758..dc54f89 100644
--- a/core/modules/taxonomy/config/schema/taxonomy.views.schema.yml
+++ b/core/modules/taxonomy/config/schema/taxonomy.views.schema.yml
@@ -93,6 +93,10 @@ views.field.term_name:
       type: boolean
       label: 'Convert spaces in term names to hyphens'
 
+views.field.taxonomy_term_bulk_form:
+  type: views_field_bulk_form
+  label: 'Taxonomy term bulk form'
+
 views.field.taxonomy_index_tid:
   type: views_field
   label: 'Taxonomy language'
diff --git a/core/modules/taxonomy/src/Plugin/views/field/TaxonomyTermBulkForm.php b/core/modules/taxonomy/src/Plugin/views/field/TaxonomyTermBulkForm.php
new file mode 100644
index 0000000..e7b01f4
--- /dev/null
+++ b/core/modules/taxonomy/src/Plugin/views/field/TaxonomyTermBulkForm.php
@@ -0,0 +1,21 @@
+<?php
+
+namespace Drupal\taxonomy\Plugin\views\field;
+
+use Drupal\system\Plugin\views\field\BulkForm;
+
+/**
+ * Defines a taxonomy term operations bulk form element.
+ *
+ * @ViewsField("taxonomy_term_bulk_form")
+ */
+class TaxonomyTermBulkForm extends BulkForm {
+
+  /**
+   * {@inheritdoc}
+   */
+  protected function emptySelectedMessage() {
+    return $this->t('No term selected.');
+  }
+
+}
diff --git a/core/modules/taxonomy/src/TermViewsData.php b/core/modules/taxonomy/src/TermViewsData.php
index 89b2b55..ff7f0bc 100644
--- a/core/modules/taxonomy/src/TermViewsData.php
+++ b/core/modules/taxonomy/src/TermViewsData.php
@@ -133,6 +133,14 @@ public function getViewsData() {
       ),
     );
 
+    $data['taxonomy_term_data']['taxonomy_term_bulk_form'] = array(
+      'title' => $this->t('Taxonomy term operations bulk form'),
+      'help' => $this->t('Add a form element that lets you run operations on multiple taxonomy terms.'),
+      'field' => array(
+        'id' => 'taxonomy_term_bulk_form',
+      ),
+    );
+
     $data['taxonomy_index']['table']['group']  = $this->t('Taxonomy term');
 
     $data['taxonomy_index']['table']['join'] = array(
-- 
1.9.1

