diff --git a/config/sync/block.block.olivero_moderationinfocontent.yml b/config/sync/block.block.olivero_moderationinfocontent.yml deleted file mode 100644 index 70d282e..0000000 --- a/config/sync/block.block.olivero_moderationinfocontent.yml +++ /dev/null @@ -1,28 +0,0 @@ -uuid: 882a1fb8-dba5-4370-b1c4-fb8b5d46db4c -langcode: en -status: true -dependencies: - module: - - content_moderation_info_block - theme: - - olivero -id: olivero_moderationinfocontent -theme: olivero -region: content -weight: 0 -provider: null -plugin: 'content_moderation_info_block:node' -settings: - id: 'content_moderation_info_block:node' - label: 'Moderation info (Content)' - label_display: visible - provider: content_moderation_info_block - context_mapping: - entity: '@node.node_route_context:node' - changed_date_display: true - author_display: true - latest_revision_display: true - current_state_display: true - change_state_display: true - revision_log_message_input_display: false -visibility: { } diff --git a/config/sync/block.block.olivero_moderationinfocontent_2.yml b/config/sync/block.block.olivero_moderationinfocontent_2.yml new file mode 100644 index 0000000..6794ded --- /dev/null +++ b/config/sync/block.block.olivero_moderationinfocontent_2.yml @@ -0,0 +1,28 @@ +uuid: 2f782113-6263-4112-8cb9-f4de096fabda +langcode: en +status: true +dependencies: + module: + - yufu_concept + theme: + - olivero +id: olivero_moderationinfocontent_2 +theme: olivero +region: sidebar +weight: 0 +provider: null +plugin: 'yufu_concept_moderate_from_diff:node' +settings: + id: 'yufu_concept_moderate_from_diff:node' + label: 'YUFU Moderation info from diff (Content)' + label_display: visible + provider: yufu_concept + context_mapping: + entity: '@node.node_route_context:node' + changed_date_display: 1 + author_display: 1 + latest_revision_display: 1 + current_state_display: 1 + change_state_display: 1 + revision_log_message_input_display: 0 +visibility: { } diff --git a/config/sync/views.view.zadnje_spremembe.yml b/config/sync/views.view.zadnje_spremembe.yml index ad2d7b4..d0c740e 100644 --- a/config/sync/views.view.zadnje_spremembe.yml +++ b/config/sync/views.view.zadnje_spremembe.yml @@ -24,6 +24,204 @@ display: display_options: title: 'Zadnje spremembe' fields: + nid: + id: nid + table: node_field_revision + field: nid + relationship: none + group_type: group + admin_label: '' + entity_type: node + entity_field: nid + plugin_id: field + label: nID + 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 + click_sort_column: value + type: number_integer + settings: + thousand_separator: '' + prefix_suffix: true + group_column: value + group_columns: { } + group_rows: true + delta_limit: 0 + delta_offset: 0 + delta_reversed: false + delta_first_last: false + multi_type: separator + separator: ', ' + field_api_classes: false + vid_1: + id: vid_1 + table: node_field_revision + field: vid + relationship: none + group_type: group + admin_label: '' + entity_type: node + entity_field: vid + plugin_id: field + label: rID + 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 + click_sort_column: value + type: number_integer + settings: + thousand_separator: '' + prefix_suffix: true + group_column: value + group_columns: { } + group_rows: true + delta_limit: 0 + delta_offset: 0 + delta_reversed: false + delta_first_last: false + multi_type: separator + separator: ', ' + field_api_classes: false + vid: + id: vid + table: node_field_revision + field: vid + relationship: nid + group_type: group + admin_label: '' + entity_type: node + entity_field: vid + plugin_id: field + label: 'Latest Revision ID' + 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 + click_sort_column: value + type: number_integer + settings: + thousand_separator: '' + prefix_suffix: true + group_column: value + group_columns: { } + group_rows: true + delta_limit: 0 + delta_offset: 0 + delta_reversed: false + delta_first_last: false + multi_type: separator + separator: ', ' + field_api_classes: false title: id: title table: node_field_revision @@ -39,8 +237,8 @@ display: alter: alter_text: false text: '' - make_link: false - path: '' + make_link: true + path: '/node/{{nid}}/revisions/view/{{vid}}/{{vid_1}}/visual_inline' absolute: false external: false replace_spaces: false @@ -78,7 +276,7 @@ display: click_sort_column: value type: string settings: - link_to_entity: true + link_to_entity: false group_column: value group_columns: { } group_rows: true @@ -294,138 +492,6 @@ display: multi_type: separator separator: ', ' field_api_classes: false - vid_1: - id: vid_1 - table: node_field_revision - field: vid - relationship: none - group_type: group - admin_label: '' - entity_type: node - entity_field: vid - plugin_id: field - label: rID - 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 - click_sort_column: value - type: number_integer - settings: - thousand_separator: '' - prefix_suffix: true - group_column: value - group_columns: { } - group_rows: true - delta_limit: 0 - delta_offset: 0 - delta_reversed: false - delta_first_last: false - multi_type: separator - separator: ', ' - field_api_classes: false - nid: - id: nid - table: node_field_revision - field: nid - relationship: none - group_type: group - admin_label: '' - entity_type: node - entity_field: nid - plugin_id: field - label: nID - 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 - click_sort_column: value - type: number_integer - settings: - thousand_separator: '' - prefix_suffix: true - group_column: value - group_columns: { } - group_rows: true - delta_limit: 0 - delta_offset: 0 - delta_reversed: false - delta_first_last: false - multi_type: separator - separator: ', ' - field_api_classes: false pager: type: mini options: diff --git a/web/modules/custom/yufu_concept/src/Plugin/Block/ModerateFromDiffBlock.php b/web/modules/custom/yufu_concept/src/Plugin/Block/ModerateFromDiffBlock.php new file mode 100644 index 0000000..2523f1c --- /dev/null +++ b/web/modules/custom/yufu_concept/src/Plugin/Block/ModerateFromDiffBlock.php @@ -0,0 +1,64 @@ +getConfiguration(); + $entity = $this->getContextValue('entity'); + + $routeMatcher = \Drupal::service('current_route_match'); + + if ($routeMatcher->getRouteName() !== 'diff.revisions_diff') { + return []; + } + $revisionId = $routeMatcher->getParameter('right_revision'); + $revision = $this->entityTypeManager->getStorage('node')->loadRevision($revisionId); + + if (!$revision) { + return []; + } + + if ($configuration['change_state_display']) { + $class = NULL; + if ($this->moderationInfo->isModeratedEntity($revision)) { + $class = ContentModerationInfoBlockModerationForm::class; + } + elseif ($revision instanceof EntityPublishedInterface) { + $class = ContentModerationInfoBlockPublishForm::class; + } + + if ($class) { + $build['change_state'] = $this + ->formBuilder + ->getForm($class, $revision, $configuration['revision_log_message_input_display']); + } + } + + $build['#markup'] = 'Revision ID: ' . $revision->getRevisionId() + . 'Title: ' . $revision->getTitle(); + + return $build; + } +} diff --git a/web/modules/custom/yufu_concept/yufu_concept.info.yml b/web/modules/custom/yufu_concept/yufu_concept.info.yml index cfc664a..9bfd66c 100644 --- a/web/modules/custom/yufu_concept/yufu_concept.info.yml +++ b/web/modules/custom/yufu_concept/yufu_concept.info.yml @@ -5,3 +5,4 @@ package: Yufu core_version_requirement: ^9 || ^10 dependencies: - drupal:rest + - content_moderation_info_block:content_moderation_info_block