diff --git a/modules/paragraphs_library/config/install/views.view.paragraphs_library.yml b/modules/paragraphs_library/config/install/views.view.paragraphs_library.yml index e63b829..0d8d75d 100644 --- a/modules/paragraphs_library/config/install/views.view.paragraphs_library.yml +++ b/modules/paragraphs_library/config/install/views.view.paragraphs_library.yml @@ -78,7 +78,8 @@ display: columns: label: label type: type - paragraphs__target_id: paragraphs__target_id + id: id + count: count operations: operations info: label: @@ -95,13 +96,20 @@ display: separator: '' empty_column: false responsive: '' - paragraphs__target_id: + id: sortable: false default_sort_order: asc align: '' separator: '' empty_column: false responsive: '' + count: + sortable: false + default_sort_order: asc + align: views-align-right + separator: '' + empty_column: false + responsive: '' operations: align: '' separator: '' @@ -242,57 +250,6 @@ display: entity_type: paragraph entity_field: type plugin_id: field - operations: - id: operations - table: paragraphs_library_item - field: operations - relationship: none - group_type: group - admin_label: '' - label: Operations - exclude: false - alter: - alter_text: false - text: '' - make_link: false - path: '' - absolute: false - external: false - replace_spaces: false - path_case: none - trim_whitespace: false - alt: '' - rel: '' - link_class: '' - prefix: '' - suffix: '' - target: '' - nl2br: false - max_length: 0 - word_boundary: true - ellipsis: true - more_link: false - more_link_text: '' - more_link_path: '' - strip_tags: false - trim: false - preserve_tags: '' - html: false - element_type: '' - element_class: '' - element_label_type: '' - element_label_class: '' - element_label_colon: true - element_wrapper_type: '' - element_wrapper_class: '' - element_default_classes: true - empty: '' - hide_empty: false - empty_zero: false - hide_alter_empty: true - destination: true - entity_type: paragraphs_library_item - plugin_id: entity_operations id: id: id table: paragraphs_library_item @@ -364,7 +321,7 @@ display: relationship: paragraphs_library_item_to_usage_entity group_type: count admin_label: '' - label: 'Used in' + label: Used exclude: false alter: alter_text: false @@ -409,11 +366,62 @@ display: precision: 0 decimal: . separator: ',' - format_plural: true + format_plural: false format_plural_string: "1 place\x03@count places" prefix: '' suffix: '' plugin_id: numeric + operations: + id: operations + table: paragraphs_library_item + field: operations + relationship: none + group_type: group + admin_label: '' + label: Operations + exclude: false + alter: + alter_text: false + text: '' + make_link: false + path: '' + absolute: false + external: false + replace_spaces: false + path_case: none + trim_whitespace: false + alt: '' + rel: '' + link_class: '' + prefix: '' + suffix: '' + target: '' + nl2br: false + max_length: 0 + word_boundary: true + ellipsis: true + more_link: false + more_link_text: '' + more_link_path: '' + strip_tags: false + trim: false + preserve_tags: '' + html: false + element_type: '' + element_class: '' + element_label_type: '' + element_label_class: '' + element_label_colon: true + element_wrapper_type: '' + element_wrapper_class: '' + element_default_classes: true + empty: '' + hide_empty: false + empty_zero: false + hide_alter_empty: true + destination: true + entity_type: paragraphs_library_item + plugin_id: entity_operations filters: label: id: label diff --git a/modules/paragraphs_library/paragraphs_library.module b/modules/paragraphs_library/paragraphs_library.module index 3ef6723..e2ea38d 100644 --- a/modules/paragraphs_library/paragraphs_library.module +++ b/modules/paragraphs_library/paragraphs_library.module @@ -42,7 +42,7 @@ function paragraphs_library_form_paragraphs_library_item_edit_form_alter(&$form, $usage_data = \Drupal::service('entity_usage.usage')->listUsage($library_item); if ($usage_data) { - $usage_count = paragraphs_library_count_usage($usage_data); + $usage_count = _paragraphs_library_count_usage($usage_data); drupal_set_message(\Drupal::translation()->formatPlural($usage_count, 'Library item is used 1 time.', 'Library item is used @count times.', [ '@count' => $usage_count, ]), 'warning'); @@ -58,7 +58,7 @@ function paragraphs_library_form_paragraphs_library_item_edit_form_alter(&$form, * @return int * Returns the count of entity usage across all entities. */ -function paragraphs_library_count_usage(array $usage_data) { +function _paragraphs_library_count_usage(array $usage_data) { $count = 0; foreach ($usage_data as $entity => $ids) { $count += array_sum($ids);