Skip to content
Snippets Groups Projects
Commit 5ff7e223 authored by Steve Wirt's avatar Steve Wirt
Browse files

Make plugin more generic.

parent 043afc80
No related branches found
No related tags found
No related merge requests found
......@@ -576,15 +576,15 @@ display:
hide_empty: false
empty_zero: false
hide_alter_empty: true
content_model_operations:
id: content_model_operations
non_delete_operations:
id: non_delete_operations
table: config_field_field
field: content_model_operations
field: non_delete_operations
relationship: none
group_type: group
admin_label: ''
entity_type: field_config
plugin_id: content_model_operations
plugin_id: non_delete_operations
label: Operations
exclude: false
alter:
......
......@@ -30,13 +30,12 @@ function content_model_documentation_views_data_alter(array &$data) {
// Find each instance where config_views supplied operations.
// Attach our operations view field implementation (no delete).
foreach ($data as $table_name => $settings) {
if (str_starts_with($table_name, 'config_')
&& array_key_exists('operation', $settings)) {
$data[$table_name]['content_model_operations'] = [
if (array_key_exists('operation', $settings)) {
$data[$table_name]['non_delete_operations'] = [
'title' => t('Operations'),
'help' => t('Content Model Operations'),
'help' => t('Operations without delete option'),
'field' => [
'id' => 'content_model_operations',
'id' => 'non_delete_operations',
],
];
}
......
......@@ -6,12 +6,11 @@ use Drupal\views\Plugin\views\field\FieldPluginBase;
use Drupal\views\ResultRow;
/**
* Field handler to display entity operations.
* Based on ConfigEntityOperations in config_views without delete option.
* Field handler to display entity operations without a delete option.
*
* @ViewsField("content_model_operations")
* @ViewsField("non_delete_operations")
*/
class ContentModelOperations extends FieldPluginBase {
class NonDeleteOperations extends FieldPluginBase {
/**
* {@inheritdoc}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment