From f01f264ad9393b8591569be327f65f8ff986c998 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jurij=20Podgor=C5=A1ek?= Date: Wed, 24 Jul 2024 14:41:25 +0200 Subject: [PATCH] COnfig export, popravljeno in dopolnjeno prevajanje --- config/sync/block_content.type.basic.yml | 2 +- ....entity_form_display.node.page.default.yml | 32 ++- ....entity_view_display.node.page.default.yml | 11 + ...e.entity_view_display.node.page.teaser.yml | 2 + ...d.field.node.page.field_strojni_prevod.yml | 23 ++ ...ore.entity_view_mode.node.search_index.yml | 1 - .../sl/core.entity_view_mode.node.teaser.yml | 1 - ...re.entity_view_mode.taxonomy_term.full.yml | 1 - .../language/sl/views.view.block_content.yml | 4 +- .../sync/language/sl/views.view.comment.yml | 2 +- .../sl/views.view.comments_recent.yml | 2 +- config/sync/language/sl/views.view.media.yml | 3 +- .../language/sl/views.view.media_library.yml | 11 +- .../sl/views.view.moderated_content.yml | 7 +- .../language/sl/views.view.taxonomy_term.yml | 9 +- config/sync/node.type.article.yml | 2 +- config/sync/node.type.concept.yml | 2 +- config/sync/node.type.page.yml | 2 +- config/sync/system.cron.yml | 2 +- config/sync/system.date.yml | 6 +- config/sync/taxonomy.vocabulary.tags.yml | 1 + config/sync/views.view.block_content.yml | 1 + config/sync/views.view.comment.yml | 1 + config/sync/views.view.content.yml | 3 +- config/sync/views.view.media.yml | 1 + config/sync/views.view.media_library.yml | 1 + config/sync/views.view.moderated_content.yml | 1 + config/sync/views.view.taxonomy_term.yml | 1 + config/sync/views.view.zadnje_spremembe.yml | 199 +++++++++----- config/sync/views.view.zadnje_spremembe_2.yml | 259 ++++++++++++++++++ .../src/Plugin/rest/resource/AddConcept.php | 20 +- .../custom/yufu_concept/src/Translate.php | 31 ++- .../custom/yufu_concept/yufu_concept.module | 41 ++- 33 files changed, 545 insertions(+), 140 deletions(-) create mode 100644 config/sync/field.field.node.page.field_strojni_prevod.yml delete mode 100644 config/sync/language/sl/core.entity_view_mode.node.search_index.yml delete mode 100644 config/sync/language/sl/core.entity_view_mode.node.teaser.yml delete mode 100644 config/sync/language/sl/core.entity_view_mode.taxonomy_term.full.yml create mode 100644 config/sync/views.view.zadnje_spremembe_2.yml diff --git a/config/sync/block_content.type.basic.yml b/config/sync/block_content.type.basic.yml index a7ef642..cfbe63a 100644 --- a/config/sync/block_content.type.basic.yml +++ b/config/sync/block_content.type.basic.yml @@ -6,5 +6,5 @@ _core: default_config_hash: zglzjmYxi0G0ag9MZ02y0LSJOdpWRwJxyP_OvFojFyo id: basic label: 'Basic block' -revision: 0 +revision: false description: 'A basic block contains a title and a body.' diff --git a/config/sync/core.entity_form_display.node.page.default.yml b/config/sync/core.entity_form_display.node.page.default.yml index 53f3967..68e6e97 100644 --- a/config/sync/core.entity_form_display.node.page.default.yml +++ b/config/sync/core.entity_form_display.node.page.default.yml @@ -5,6 +5,7 @@ dependencies: config: - field.field.node.page.body - field.field.node.page.field_media + - field.field.node.page.field_strojni_prevod - node.type.page module: - content_moderation @@ -20,7 +21,7 @@ mode: default content: body: type: text_textarea_with_summary - weight: 31 + weight: 9 region: content settings: rows: 9 @@ -30,73 +31,80 @@ content: third_party_settings: { } created: type: datetime_timestamp - weight: 10 + weight: 4 region: content settings: { } third_party_settings: { } field_media: type: media_library_widget - weight: 5 + weight: 3 region: content settings: media_types: { } third_party_settings: { } + field_strojni_prevod: + type: boolean_checkbox + weight: 12 + region: content + settings: + display_label: true + third_party_settings: { } langcode: type: language_select - weight: 2 + weight: 1 region: content settings: include_locked: true third_party_settings: { } moderation_state: type: moderation_state_default - weight: 100 + weight: 10 region: content settings: { } third_party_settings: { } path: type: path - weight: 30 + weight: 8 region: content settings: { } third_party_settings: { } promote: type: boolean_checkbox - weight: 15 + weight: 6 region: content settings: display_label: true third_party_settings: { } status: type: boolean_checkbox - weight: 120 + weight: 11 region: content settings: display_label: true third_party_settings: { } sticky: type: boolean_checkbox - weight: 16 + weight: 7 region: content settings: display_label: true third_party_settings: { } title: type: string_textfield - weight: -5 + weight: 0 region: content settings: size: 60 placeholder: '' third_party_settings: { } translation: - weight: 10 + weight: 5 region: content settings: { } third_party_settings: { } uid: type: entity_reference_autocomplete - weight: 5 + weight: 2 region: content settings: match_operator: CONTAINS diff --git a/config/sync/core.entity_view_display.node.page.default.yml b/config/sync/core.entity_view_display.node.page.default.yml index 14486d9..ecca98a 100644 --- a/config/sync/core.entity_view_display.node.page.default.yml +++ b/config/sync/core.entity_view_display.node.page.default.yml @@ -5,6 +5,7 @@ dependencies: config: - field.field.node.page.body - field.field.node.page.field_media + - field.field.node.page.field_strojni_prevod - node.type.page module: - text @@ -32,6 +33,16 @@ content: third_party_settings: { } weight: 0 region: content + field_strojni_prevod: + type: boolean + label: above + settings: + format: default + format_custom_false: '' + format_custom_true: '' + third_party_settings: { } + weight: 104 + region: content links: settings: { } third_party_settings: { } diff --git a/config/sync/core.entity_view_display.node.page.teaser.yml b/config/sync/core.entity_view_display.node.page.teaser.yml index 2249c00..b0fe8c5 100644 --- a/config/sync/core.entity_view_display.node.page.teaser.yml +++ b/config/sync/core.entity_view_display.node.page.teaser.yml @@ -6,6 +6,7 @@ dependencies: - core.entity_view_mode.node.teaser - field.field.node.page.body - field.field.node.page.field_media + - field.field.node.page.field_strojni_prevod - node.type.page module: - text @@ -30,4 +31,5 @@ content: region: content hidden: field_media: true + field_strojni_prevod: true langcode: true diff --git a/config/sync/field.field.node.page.field_strojni_prevod.yml b/config/sync/field.field.node.page.field_strojni_prevod.yml new file mode 100644 index 0000000..1ebd061 --- /dev/null +++ b/config/sync/field.field.node.page.field_strojni_prevod.yml @@ -0,0 +1,23 @@ +uuid: 2958b0de-fe09-4c7b-b5e4-a92d0ee61fb3 +langcode: sl +status: true +dependencies: + config: + - field.storage.node.field_strojni_prevod + - node.type.page +id: node.page.field_strojni_prevod +field_name: field_strojni_prevod +entity_type: node +bundle: page +label: 'Strojni prevod?' +description: '' +required: false +translatable: true +default_value: + - + value: 0 +default_value_callback: '' +settings: + on_label: Da + off_label: Ne +field_type: boolean diff --git a/config/sync/language/sl/core.entity_view_mode.node.search_index.yml b/config/sync/language/sl/core.entity_view_mode.node.search_index.yml deleted file mode 100644 index bc175c5..0000000 --- a/config/sync/language/sl/core.entity_view_mode.node.search_index.yml +++ /dev/null @@ -1 +0,0 @@ -label: 'Indeks pretraživanja' diff --git a/config/sync/language/sl/core.entity_view_mode.node.teaser.yml b/config/sync/language/sl/core.entity_view_mode.node.teaser.yml deleted file mode 100644 index 9ee0670..0000000 --- a/config/sync/language/sl/core.entity_view_mode.node.teaser.yml +++ /dev/null @@ -1 +0,0 @@ -label: Mamac diff --git a/config/sync/language/sl/core.entity_view_mode.taxonomy_term.full.yml b/config/sync/language/sl/core.entity_view_mode.taxonomy_term.full.yml deleted file mode 100644 index 40960a6..0000000 --- a/config/sync/language/sl/core.entity_view_mode.taxonomy_term.full.yml +++ /dev/null @@ -1 +0,0 @@ -label: 'Stranica taksonomijskog pojma' diff --git a/config/sync/language/sl/views.view.block_content.yml b/config/sync/language/sl/views.view.block_content.yml index 0cb9803..d8980ae 100644 --- a/config/sync/language/sl/views.view.block_content.yml +++ b/config/sync/language/sl/views.view.block_content.yml @@ -2,7 +2,7 @@ label: 'Custom block library' description: 'Find and manage custom blocks.' display: default: - display_title: Zadano + display_title: Privzeto display_options: title: 'Custom block library' fields: @@ -14,7 +14,6 @@ display: label: Operacije exposed_form: options: - submit_button: Primjeni reset_button_label: Ponastavi exposed_sorts_label: 'Rasporedi po' sort_asc_label: Naraščajoče @@ -27,7 +26,6 @@ display: expose: label: 'Opis bloka' page_1: - display_title: Stranica display_options: menu: title: 'Custom block library' diff --git a/config/sync/language/sl/views.view.comment.yml b/config/sync/language/sl/views.view.comment.yml index 760a596..ab2b18f 100644 --- a/config/sync/language/sl/views.view.comment.yml +++ b/config/sync/language/sl/views.view.comment.yml @@ -1,7 +1,7 @@ label: Komentari display: default: - display_title: Zadano + display_title: Privzeto display_options: title: Komentari fields: diff --git a/config/sync/language/sl/views.view.comments_recent.yml b/config/sync/language/sl/views.view.comments_recent.yml index d8d11a7..596cb35 100644 --- a/config/sync/language/sl/views.view.comments_recent.yml +++ b/config/sync/language/sl/views.view.comments_recent.yml @@ -1,7 +1,7 @@ label: 'Posljednji komentari' display: default: - display_title: Zadano + display_title: Privzeto display_options: title: 'Posljednji komentari' empty: diff --git a/config/sync/language/sl/views.view.media.yml b/config/sync/language/sl/views.view.media.yml index 5fffc83..0d80f3e 100644 --- a/config/sync/language/sl/views.view.media.yml +++ b/config/sync/language/sl/views.view.media.yml @@ -1,7 +1,7 @@ label: Mediji display: default: - display_title: Zadano + display_title: Privzeto display_options: title: Mediji fields: @@ -12,6 +12,7 @@ display: uid: label: Avtor status: + label: Status settings: format_custom_true: Objavljeno changed: diff --git a/config/sync/language/sl/views.view.media_library.yml b/config/sync/language/sl/views.view.media_library.yml index 9a42eaf..c2465c5 100644 --- a/config/sync/language/sl/views.view.media_library.yml +++ b/config/sync/language/sl/views.view.media_library.yml @@ -1,6 +1,6 @@ display: default: - display_title: Zadano + display_title: Privzeto display_options: title: Mediji fields: @@ -26,7 +26,6 @@ display: expose: label: Jezik page: - display_title: Stranica display_options: fields: media_bulk_form: @@ -38,10 +37,6 @@ display: widget: display_title: Widget display_options: - arguments: - bundle: - exception: - title: Svi filters: name: expose: @@ -60,10 +55,6 @@ display: label: Avtor changed: label: Posodobljeno - arguments: - bundle: - exception: - title: Svi filters: name: expose: diff --git a/config/sync/language/sl/views.view.moderated_content.yml b/config/sync/language/sl/views.view.moderated_content.yml index ff85e83..5c6cd2a 100644 --- a/config/sync/language/sl/views.view.moderated_content.yml +++ b/config/sync/language/sl/views.view.moderated_content.yml @@ -1,12 +1,14 @@ label: 'Moderirane vsebine' display: default: - display_title: Zadano + display_title: Privzeto display_options: title: 'Moderirane vsebine' fields: title: label: Naslov + type: + label: 'Content type' name: label: Avtor changed: @@ -24,6 +26,9 @@ display: title: expose: label: Naslov + type: + expose: + label: 'Content type' langcode: expose: label: Jezik diff --git a/config/sync/language/sl/views.view.taxonomy_term.yml b/config/sync/language/sl/views.view.taxonomy_term.yml index 059d806..75fa857 100644 --- a/config/sync/language/sl/views.view.taxonomy_term.yml +++ b/config/sync/language/sl/views.view.taxonomy_term.yml @@ -1,18 +1,11 @@ label: 'Pojam taksonomije' display: default: - display_title: Zadano + display_title: Privzeto display_options: exposed_form: options: - submit_button: Primjeni reset_button_label: Ponastavi exposed_sorts_label: 'Rasporedi po' sort_asc_label: Naraščajoče sort_desc_label: Padajoče - arguments: - tid: - exception: - title: Svi - page_1: - display_title: Stranica diff --git a/config/sync/node.type.article.yml b/config/sync/node.type.article.yml index 08d27c3..e5d5da0 100644 --- a/config/sync/node.type.article.yml +++ b/config/sync/node.type.article.yml @@ -7,7 +7,7 @@ _core: name: Article type: article description: 'Use articles for time-sensitive content like news, press releases or blog posts.' -help: '' +help: null new_revision: true preview_mode: 1 display_submitted: true diff --git a/config/sync/node.type.concept.yml b/config/sync/node.type.concept.yml index 07bcc0c..eb3e42c 100644 --- a/config/sync/node.type.concept.yml +++ b/config/sync/node.type.concept.yml @@ -12,7 +12,7 @@ third_party_settings: name: Koncept type: concept description: 'Osnovni element manifesta' -help: '' +help: null new_revision: true preview_mode: 1 display_submitted: true diff --git a/config/sync/node.type.page.yml b/config/sync/node.type.page.yml index ff99b98..d20d2e4 100644 --- a/config/sync/node.type.page.yml +++ b/config/sync/node.type.page.yml @@ -7,7 +7,7 @@ _core: name: 'Basic page' type: page description: "Use basic pages for your static content, such as an 'About us' page." -help: '' +help: null new_revision: true preview_mode: 1 display_submitted: false diff --git a/config/sync/system.cron.yml b/config/sync/system.cron.yml index 49e58a0..6d1cca2 100644 --- a/config/sync/system.cron.yml +++ b/config/sync/system.cron.yml @@ -3,4 +3,4 @@ _core: threshold: requirements_warning: 172800 requirements_error: 1209600 -logging: 1 +logging: true diff --git a/config/sync/system.date.yml b/config/sync/system.date.yml index 04c2439..f9a2649 100644 --- a/config/sync/system.date.yml +++ b/config/sync/system.date.yml @@ -1,10 +1,10 @@ _core: default_config_hash: t7clj3mzmOGrXX0HuCH5usf0vEqRtnMTBFVBIEmZ5pc -first_day: 0 +first_day: 1 country: - default: '' + default: null timezone: - default: UTC + default: Europe/Ljubljana user: configurable: true default: 0 diff --git a/config/sync/taxonomy.vocabulary.tags.yml b/config/sync/taxonomy.vocabulary.tags.yml index e12a369..d8199f8 100644 --- a/config/sync/taxonomy.vocabulary.tags.yml +++ b/config/sync/taxonomy.vocabulary.tags.yml @@ -8,3 +8,4 @@ name: Tags vid: tags description: 'Use tags to group articles on similar topics into categories.' weight: 0 +new_revision: false diff --git a/config/sync/views.view.block_content.yml b/config/sync/views.view.block_content.yml index 2ce24e3..0dc1494 100644 --- a/config/sync/views.view.block_content.yml +++ b/config/sync/views.view.block_content.yml @@ -273,6 +273,7 @@ display: type: mini options: offset: 0 + pagination_heading_level: h4 items_per_page: 50 total_pages: null id: 0 diff --git a/config/sync/views.view.comment.yml b/config/sync/views.view.comment.yml index 0caf7fb..d5254d2 100644 --- a/config/sync/views.view.comment.yml +++ b/config/sync/views.view.comment.yml @@ -533,6 +533,7 @@ display: type: full options: offset: 0 + pagination_heading_level: h4 items_per_page: 50 total_pages: null id: 0 diff --git a/config/sync/views.view.content.yml b/config/sync/views.view.content.yml index aab9185..9abce26 100644 --- a/config/sync/views.view.content.yml +++ b/config/sync/views.view.content.yml @@ -19,7 +19,7 @@ base_field: nid display: default: id: default - display_title: Zadano + display_title: Privzeto display_plugin: default position: 0 display_options: @@ -427,6 +427,7 @@ display: pager: type: full options: + pagination_heading_level: h4 items_per_page: 50 tags: next: 'Next ›' diff --git a/config/sync/views.view.media.yml b/config/sync/views.view.media.yml index 4784f5e..0cf603a 100644 --- a/config/sync/views.view.media.yml +++ b/config/sync/views.view.media.yml @@ -522,6 +522,7 @@ display: type: full options: offset: 0 + pagination_heading_level: h4 items_per_page: 50 total_pages: null id: 0 diff --git a/config/sync/views.view.media_library.yml b/config/sync/views.view.media_library.yml index d13b0a5..96a01d3 100644 --- a/config/sync/views.view.media_library.yml +++ b/config/sync/views.view.media_library.yml @@ -139,6 +139,7 @@ display: type: mini options: offset: 0 + pagination_heading_level: h4 items_per_page: 24 total_pages: null id: 0 diff --git a/config/sync/views.view.moderated_content.yml b/config/sync/views.view.moderated_content.yml index 4538076..087e465 100644 --- a/config/sync/views.view.moderated_content.yml +++ b/config/sync/views.view.moderated_content.yml @@ -418,6 +418,7 @@ display: type: full options: offset: 0 + pagination_heading_level: h4 items_per_page: 50 total_pages: null id: 0 diff --git a/config/sync/views.view.taxonomy_term.yml b/config/sync/views.view.taxonomy_term.yml index 088a42e..81f9b8b 100644 --- a/config/sync/views.view.taxonomy_term.yml +++ b/config/sync/views.view.taxonomy_term.yml @@ -29,6 +29,7 @@ display: type: mini options: offset: 0 + pagination_heading_level: h4 items_per_page: 10 total_pages: 0 id: 0 diff --git a/config/sync/views.view.zadnje_spremembe.yml b/config/sync/views.view.zadnje_spremembe.yml index d0c740e..9321e04 100644 --- a/config/sync/views.view.zadnje_spremembe.yml +++ b/config/sync/views.view.zadnje_spremembe.yml @@ -90,6 +90,72 @@ display: 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: 'ID stare različice' + exclude: true + 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 @@ -156,72 +222,6 @@ display: 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 @@ -287,6 +287,72 @@ display: multi_type: separator separator: ', ' field_api_classes: false + langcode: + id: langcode + table: node_field_revision + field: langcode + relationship: nid + group_type: group + admin_label: '' + entity_type: node + entity_field: langcode + plugin_id: field_language + label: Jezik + 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: language + settings: + link_to_entity: 0 + native_language: 0 + 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: 0 moderation_state: id: moderation_state table: node_field_revision @@ -496,6 +562,7 @@ display: type: mini options: offset: 0 + pagination_heading_level: h4 items_per_page: 20 total_pages: null id: 0 diff --git a/config/sync/views.view.zadnje_spremembe_2.yml b/config/sync/views.view.zadnje_spremembe_2.yml new file mode 100644 index 0000000..349665b --- /dev/null +++ b/config/sync/views.view.zadnje_spremembe_2.yml @@ -0,0 +1,259 @@ +uuid: 251e836d-f4e6-4f56-b284-0dad8b4c002c +langcode: sl +status: true +dependencies: + config: + - node.type.concept + module: + - node + - user +id: zadnje_spremembe_2 +label: 'Zadnje spremembe 2' +module: views +description: '' +tag: '' +base_table: node_field_revision +base_field: nid +display: + default: + id: default + display_title: Default + display_plugin: default + position: 0 + display_options: + title: 'Zadnje spremembe 2' + fields: + changed: + id: changed + table: node_field_revision + field: changed + relationship: none + group_type: group + admin_label: '' + entity_type: node + entity_field: changed + plugin_id: field + label: '' + exclude: false + alter: + alter_text: false + make_link: false + absolute: false + word_boundary: false + ellipsis: false + strip_tags: false + trim: false + 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: timestamp + settings: + date_format: medium + custom_date_format: '' + timezone: '' + tooltip: + date_format: '' + custom_date_format: '' + time_diff: + enabled: false + future_format: '@interval hence' + past_format: '@interval ago' + granularity: 2 + refresh: 60 + 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 + field: title + relationship: none + group_type: group + admin_label: '' + entity_type: node + entity_field: title + plugin_id: field + label: '' + exclude: false + alter: + alter_text: false + make_link: false + absolute: false + word_boundary: false + ellipsis: false + strip_tags: false + trim: false + 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: string + settings: + link_to_entity: false + 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: + offset: 0 + pagination_heading_level: h4 + items_per_page: 10 + total_pages: null + id: 0 + tags: + next: ›› + previous: ‹‹ + expose: + items_per_page: false + items_per_page_label: 'Items per page' + items_per_page_options: '5, 10, 25, 50' + items_per_page_options_all: false + items_per_page_options_all_label: '- All -' + offset: false + offset_label: Offset + exposed_form: + type: basic + options: + submit_button: Apply + reset_button: false + reset_button_label: Ponastavi + exposed_sorts_label: 'Rasporedi po' + expose_sort_order: true + sort_asc_label: Naraščajoče + sort_desc_label: Padajoče + access: + type: perm + options: + perm: 'view all revisions' + cache: + type: tag + options: { } + empty: { } + sorts: + changed: + id: changed + table: node_field_revision + field: changed + relationship: none + group_type: group + admin_label: '' + entity_type: node + entity_field: changed + plugin_id: date + order: DESC + expose: + label: '' + field_identifier: '' + exposed: false + granularity: second + arguments: { } + filters: + status: + id: status + table: node_field_revision + field: status + entity_type: node + entity_field: status + plugin_id: boolean + value: '1' + group: 1 + expose: + operator: '' + type: + id: type + table: node_field_data + field: type + relationship: nid + entity_type: node + entity_field: type + plugin_id: bundle + value: + concept: concept + style: + type: default + row: + type: fields + query: + type: views_query + options: + query_comment: '' + disable_sql_rewrite: false + distinct: false + replica: false + query_tags: { } + relationships: + nid: + id: nid + table: node_field_revision + field: nid + relationship: none + group_type: group + admin_label: 'Get the actual content from a content revision.' + entity_type: node + entity_field: nid + plugin_id: standard + required: true + header: { } + footer: { } + cache_metadata: + max-age: -1 + contexts: + - 'languages:language_content' + - 'languages:language_interface' + - url.query_args + - 'user.node_grants:view' + - user.permissions + tags: { } + page_1: + id: page_1 + display_title: Page + display_plugin: page + position: 1 + display_options: + display_extenders: { } + path: zadnje-spremembe-2 + cache_metadata: + max-age: -1 + contexts: + - 'languages:language_content' + - 'languages:language_interface' + - url.query_args + - 'user.node_grants:view' + - user.permissions + tags: { } diff --git a/web/modules/custom/yufu_concept/src/Plugin/rest/resource/AddConcept.php b/web/modules/custom/yufu_concept/src/Plugin/rest/resource/AddConcept.php index 3a75ae5..0e40b1c 100644 --- a/web/modules/custom/yufu_concept/src/Plugin/rest/resource/AddConcept.php +++ b/web/modules/custom/yufu_concept/src/Plugin/rest/resource/AddConcept.php @@ -111,14 +111,20 @@ class AddConcept extends ResourceBase { if (!$this->currentUser->hasPermission('access content')) { throw new AccessDeniedHttpException(); } - // Fields: naslov, text, povezani pojmi, email - // Optional fields: language, related concept. - if (empty($data['title']) || empty($data['text']) || empty($data['uuid'])) { - throw new MissingDataException('Title, uuid or text missing.'); + // Fields: naslov, text, email, language + // Optional fields: email, related_concept @TODO + if (empty($data['title']) || empty($data['text']) || empty($data['uuid']) || empty($data['language'])) { + throw new MissingDataException('Title, uuid, text or language missing.'); } $uid = $this->getUserIdByEmail($data['email'] ?? null); if ($concept = $this->getConceptFromUuid($data['uuid'])) { // Concept exists - create a new revision. + if ($concept->hasTranslation($data['language'])) { + $concept = $concept->getTranslation($data['language']); + } else { + $concept = $concept->addTranslation($data['language']); + } + $concept->setNewRevision(TRUE); $concept->setRevisionUserId($uid); $concept->setRevisionCreationTime(\Drupal::time()->getRequestTime()); @@ -133,14 +139,14 @@ class AddConcept extends ResourceBase { $concept->setRevisionLogMessage('New revision by concept endpoint.'); $concept->set('moderation_state', 'draft'); $concept->set('status', 0); + $concept->set('field_strojni_prevod', 0); $concept->save(); $this->logger->notice('New concept @title revision @revid created by uid @uid.', [ '@title' => $concept->getTitle(), '@revid' => $concept->getRevisionId(), '@uid' => $uid, ]); - } - else { + } else { // Concept does not exist - create a new node. $concept = [ 'type' => 'concept', @@ -149,6 +155,8 @@ class AddConcept extends ResourceBase { 'uuid' => $data['uuid'], 'uid' => $uid, 'moderation_state' => 'draft', + 'field_strojni_prevod' => 0, + 'language' => $data['language'] ]; // @TODO Check if related concepts are set and add them to the concept. // @TODO Check language and add set it on concept if exists. diff --git a/web/modules/custom/yufu_concept/src/Translate.php b/web/modules/custom/yufu_concept/src/Translate.php index 92d0e0a..d5b8242 100644 --- a/web/modules/custom/yufu_concept/src/Translate.php +++ b/web/modules/custom/yufu_concept/src/Translate.php @@ -7,6 +7,7 @@ namespace Drupal\yufu_concept; use Psr\Http\Client\ClientInterface; use Drupal\Core\Site\Settings; use GuzzleHttp\Psr7\Response; +use GuzzleHttp\Exception\BadResponseException; /** * Ta service omogoča prevajanje preko libretranslate APIja. @@ -31,18 +32,26 @@ final class Translate { * Prevede $besedila iz $izvorniJezik v $ciljniJezik */ public function prevedi(array $besedila, $izvorniJezik, $ciljniJezik): ?array { - $odziv = $this->request('translate', [ - 'json' => [ - 'q' => $besedila, - 'source' => $izvorniJezik, - 'target' => $ciljniJezik, - 'format' => 'text' - ] - ]); + $retry = 0; + while ($retry < 3) { + try { + $odziv = $this->request('translate', [ + 'json' => [ + 'q' => $besedila, + 'source' => $izvorniJezik, + 'target' => $ciljniJezik, + 'format' => 'text' + ] + ]); - if ($odziv->getStatusCode() == 200) { - $json = json_decode($odziv->getBody()->getContents(), true); - return $json['translatedText']; + if ($odziv->getStatusCode() == 200) { + $json = json_decode($odziv->getBody()->getContents(), true); + return $json['translatedText']; + } + $retry += 1; + } catch (BadResponseException $e) { + $retry += 1; + } } return null; diff --git a/web/modules/custom/yufu_concept/yufu_concept.module b/web/modules/custom/yufu_concept/yufu_concept.module index a556517..9e56e8e 100644 --- a/web/modules/custom/yufu_concept/yufu_concept.module +++ b/web/modules/custom/yufu_concept/yufu_concept.module @@ -15,9 +15,10 @@ use Symfony\Component\HttpClient\HttpClient; */ function yufu_concept_node_presave(EntityInterface $entity) { if ($entity instanceOf NodeInterface && $entity->bundle() == 'concept') { - // Dodaj avtorja spremembe med urednike, če še ni $transition = \Drupal::service('content_moderation_notifications.notification_information')->getTransition($entity); - if ($transition->id() == 'publish') { + // Ko je sprememba koncepta potrjena + if ($transition->id() == 'publish' && !$entity->field_strojni_prevod->value) { + // Dodaj avtorja spremembe med urednike, če še ni if ($user = $entity->uid->entity) { if (!$user->status->value) { $user->set('status', 1); @@ -29,13 +30,34 @@ function yufu_concept_node_presave(EntityInterface $entity) { } } -// Dodaj oz. posodobi manjkajoce prevode (ampak samo ce ne gre za -// strojni prevod!) +// Dodaj oz. posodobi manjkajoce prevode navadnih strani function yufu_concept_node_insert(EntityInterface $entity) { - uskladi_prevode($entity); + if ($entity instanceOf NodeInterface && $entity->bundle() == 'page') { + uskladi_prevode($entity); + } + + if ($entity instanceOf NodeInterface && $entity->bundle() == 'concept') { + $transition = \Drupal::service('content_moderation_notifications.notification_information')->getTransition($entity); + // Ko je sprememba koncepta potrjena + if ($transition->id() == 'publish' && !$entity->field_strojni_prevod->value) { + /* Posodobi strojne prevode */ + uskladi_prevode($entity); + } + } } function yufu_concept_node_update(EntityInterface $entity) { - uskladi_prevode($entity); + if ($entity instanceOf NodeInterface && $entity->bundle() == 'page') { + uskladi_prevode($entity); + } + + if ($entity instanceOf NodeInterface && $entity->bundle() == 'concept') { + $transition = \Drupal::service('content_moderation_notifications.notification_information')->getTransition($entity); + // Ko je sprememba koncepta potrjena + if ($transition->id() == 'publish' && !$entity->field_strojni_prevod->value) { + /* Posodobi strojne prevode */ + uskladi_prevode($entity); + } + } } function prevedi_koncept(EntityInterface $entity, EntityInterface $prevod) { @@ -66,12 +88,14 @@ function prevedi_koncept(EntityInterface $entity, EntityInterface $prevod) { $prevod->set('title', $naslov); $prevod->set('body', $tekst); + $prevod->setNewRevision(); + $prevod->moderation_state = 'published'; } function uskladi_prevode(EntityInterface $entity) { if ($entity instanceOf NodeInterface - && $entity->bundle() == 'concept' - && !$entity->field_strojni_prevod->value) { + && !$entity->field_strojni_prevod->value + && ($entity->bundle() == 'concept' || $entity->bundle() == 'page')) { $vsiJeziki = array_keys(\Drupal::languageManager()->getLanguages()); @@ -86,6 +110,7 @@ function uskladi_prevode(EntityInterface $entity) { $prevod = $entity->addTranslation($jezik, $entity->toArray()); prevedi_koncept($entity, $prevod); $prevod->set('field_strojni_prevod', true); + $prevod->setNewRevision(); $prevod->save(); $ostaliJeziki = array_diff($ostaliJeziki, [$jezik]);