Skip to content

Commit

Permalink
Merge pull request #534 from openeuropa/EWPP-1777
Browse files Browse the repository at this point in the history
EWPP-1777: Enable 'Include past revisions' option in composite fields.
  • Loading branch information
yenyasinn authored May 16, 2022
2 parents 5385f29 + 32c812a commit 45e72f4
Show file tree
Hide file tree
Showing 50 changed files with 283 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ dependencies:
third_party_settings:
composite_reference:
composite: true
composite_revisions: true
id: node.oe_call_proposals.oe_call_proposals_contact
field_name: oe_call_proposals_contact
entity_type: node
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ dependencies:
third_party_settings:
composite_reference:
composite: false
composite_revisions: false
id: node.oe_call_proposals.oe_documents
field_name: oe_documents
entity_type: node
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
declare(strict_types = 1);

use Drupal\Core\Entity\Entity\EntityFormDisplay;
use Drupal\field\Entity\FieldConfig;

/**
* Set inline entity form widgets reference removal policy to keep entities.
Expand All @@ -18,3 +19,18 @@ function oe_content_call_proposals_post_update_00001(): void {
$component['settings']['removed_reference'] = 'keep';
$form_display->setComponent('oe_call_proposals_contact', $component)->save();
}

/**
* Set "composite revisions" option for reference fields.
*/
function oe_content_call_proposals_post_update_00002(): void {
$fields = [
'node.oe_call_proposals.oe_call_proposals_contact' => TRUE,
'node.oe_call_proposals.oe_documents' => FALSE,
];
foreach ($fields as $field => $value) {
$field_config = FieldConfig::load($field);
$field_config->setThirdPartySetting('composite_reference', 'composite_revisions', $value);
$field_config->save();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ dependencies:
third_party_settings:
composite_reference:
composite: false
composite_revisions: false
id: node.oe_call_tenders.oe_documents
field_name: oe_documents
entity_type: node
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
declare(strict_types = 1);

use Drupal\Core\Config\FileStorage;
use Drupal\field\Entity\FieldConfig;

/**
* Add maxlegnth to oe_content_short_title, oe_summary, oe_teaser, title.
Expand All @@ -26,3 +27,12 @@ function oe_content_call_tenders_post_update_00001() {
$form_display->save();
}
}

/**
* Set "composite revisions" option for reference fields.
*/
function oe_content_call_tenders_post_update_00002(): void {
$field_config = FieldConfig::load('node.oe_call_tenders.oe_documents');
$field_config->setThirdPartySetting('composite_reference', 'composite_revisions', FALSE);
$field_config->save();
}
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ dependencies:
third_party_settings:
composite_reference:
composite: true
composite_revisions: true
id: node.oe_consultation.oe_consultation_contacts
field_name: oe_consultation_contacts
entity_type: node
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ dependencies:
third_party_settings:
composite_reference:
composite: true
composite_revisions: true
id: node.oe_consultation.oe_consultation_documents
field_name: oe_consultation_documents
entity_type: node
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ dependencies:
third_party_settings:
composite_reference:
composite: false
composite_revisions: false
id: node.oe_consultation.oe_consultation_outcome_files
field_name: oe_consultation_outcome_files
entity_type: node
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
<?php

/**
* @file
* OpenEuropa Consultation Content post updates.
*/

declare(strict_types = 1);

use Drupal\field\Entity\FieldConfig;

/**
* Set "composite revisions" option for reference fields.
*/
function oe_content_consultation_post_update_00001(): void {
$fields = [
'node.oe_consultation.oe_consultation_contacts' => TRUE,
'node.oe_consultation.oe_consultation_documents' => TRUE,
'node.oe_consultation.oe_consultation_outcome_files' => FALSE,
];
foreach ($fields as $field => $value) {
$field_config = FieldConfig::load($field);
$field_config->setThirdPartySetting('composite_reference', 'composite_revisions', $value);
$field_config->save();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ dependencies:
third_party_settings:
composite_reference:
composite: true
composite_revisions: true
id: node.oe_event.oe_event_contact
field_name: oe_event_contact
entity_type: node
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ dependencies:
third_party_settings:
composite_reference:
composite: false
composite_revisions: false
id: node.oe_event.oe_event_media
field_name: oe_event_media
entity_type: node
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ dependencies:
third_party_settings:
composite_reference:
composite: true
composite_revisions: true
id: node.oe_event.oe_event_venue
field_name: oe_event_venue
entity_type: node
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ dependencies:
third_party_settings:
composite_reference:
composite: false
composite_revisions: false
id: oe_event_speaker.oe_default.oe_person
field_name: oe_person
entity_type: oe_event_speaker
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
<?php

/**
* @file
* Post update functions for OpenEuropa Content Event Person reference module.
*/

declare(strict_types = 1);

use Drupal\field\Entity\FieldConfig;

/**
* Set "composite revisions" option for reference fields.
*/
function oe_content_event_person_reference_post_update_00001(): void {
$field_config = FieldConfig::load('oe_event_speaker.oe_default.oe_person');
$field_config->setThirdPartySetting('composite_reference', 'composite_revisions', FALSE);
$field_config->save();
}
16 changes: 16 additions & 0 deletions modules/oe_content_event/oe_content_event.post_update.php
Original file line number Diff line number Diff line change
Expand Up @@ -133,3 +133,19 @@ function oe_content_event_post_update_20003(): void {
$field_config->setSetting('title', 2);
$field_config->save();
}

/**
* Set "composite revisions" option for reference fields.
*/
function oe_content_event_post_update_20004(): void {
$fields = [
'node.oe_event.oe_event_contact' => TRUE,
'node.oe_event.oe_event_media' => FALSE,
'node.oe_event.oe_event_venue' => TRUE,
];
foreach ($fields as $field => $value) {
$field_config = FieldConfig::load($field);
$field_config->setThirdPartySetting('composite_reference', 'composite_revisions', $value);
$field_config->save();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ dependencies:
third_party_settings:
composite_reference:
composite: true
composite_revisions: true
id: node.oe_news.oe_news_contacts
field_name: oe_news_contacts
entity_type: node
Expand Down
9 changes: 9 additions & 0 deletions modules/oe_content_news/oe_content_news.post_update.php
Original file line number Diff line number Diff line change
Expand Up @@ -131,3 +131,12 @@ function oe_content_news_post_update_20009(): void {
$updated_form_display->save();
}
}

/**
* Enable "composite revisions" option for "Contacts" field.
*/
function oe_content_news_post_update_20010(): void {
$field_config = FieldConfig::load('node.oe_news.oe_news_contacts');
$field_config->setThirdPartySetting('composite_reference', 'composite_revisions', TRUE);
$field_config->save();
}
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ dependencies:
third_party_settings:
composite_reference:
composite: false
composite_revisions: false
id: node.oe_organisation.oe_organisation_chart
field_name: oe_organisation_chart
entity_type: node
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ dependencies:
third_party_settings:
composite_reference:
composite: true
composite_revisions: true
id: node.oe_organisation.oe_organisation_contact
field_name: oe_organisation_contact
entity_type: node
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ dependencies:
third_party_settings:
composite_reference:
composite: false
composite_revisions: false
id: node.oe_organisation.oe_organisation_logo
field_name: oe_organisation_logo
entity_type: node
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ dependencies:
third_party_settings:
composite_reference:
composite: false
composite_revisions: false
id: node.oe_organisation.oe_organisation_persons
field_name: oe_organisation_persons
entity_type: node
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
<?php

/**
* @file
* Post update functions for OpenEuropa Organisation Person Reference module.
*/

declare(strict_types = 1);

use Drupal\field\Entity\FieldConfig;

/**
* Set "composite revisions" option for reference fields.
*/
function oe_content_organisation_person_reference_post_update_00001(): void {
$field_config = FieldConfig::load('node.oe_organisation.oe_organisation_persons');
$field_config->setThirdPartySetting('composite_reference', 'composite_revisions', FALSE);
$field_config->save();
}
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ dependencies:
third_party_settings:
composite_reference:
composite: false
composite_revisions: false
id: oe_contact.oe_organisation_reference.oe_node_reference
field_name: oe_node_reference
entity_type: oe_contact
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
<?php

/**
* @file
* Post update functions for OpenEuropa Organisation Reference module.
*/

declare(strict_types = 1);

use Drupal\field\Entity\FieldConfig;

/**
* Set "composite revisions" option for reference fields.
*/
function oe_content_organisation_reference_post_update_00001(): void {
$field_config = FieldConfig::load('oe_contact.oe_organisation_reference.oe_node_reference');
$field_config->setThirdPartySetting('composite_reference', 'composite_revisions', FALSE);
$field_config->save();
}
Original file line number Diff line number Diff line change
Expand Up @@ -95,3 +95,19 @@ function oe_content_organisation_post_update_20006() {
$updated_form_display->save();
}
}

/**
* Set "composite revisions" option for reference fields.
*/
function oe_content_organisation_post_update_20007(): void {
$fields = [
'node.oe_organisation.oe_organisation_chart' => FALSE,
'node.oe_organisation.oe_organisation_contact' => TRUE,
'node.oe_organisation.oe_organisation_logo' => FALSE,
];
foreach ($fields as $field => $value) {
$field_config = FieldConfig::load($field);
$field_config->setThirdPartySetting('composite_reference', 'composite_revisions', $value);
$field_config->save();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ dependencies:
third_party_settings:
composite_reference:
composite: true
composite_revisions: true
id: node.oe_person.oe_person_contacts
field_name: oe_person_contacts
entity_type: node
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ dependencies:
third_party_settings:
composite_reference:
composite: false
composite_revisions: false
id: node.oe_person.oe_person_cv
field_name: oe_person_cv
entity_type: node
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ dependencies:
third_party_settings:
composite_reference:
composite: true
composite_revisions: true
id: node.oe_person.oe_person_documents
field_name: oe_person_documents
entity_type: node
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ dependencies:
third_party_settings:
composite_reference:
composite: false
composite_revisions: false
id: node.oe_person.oe_person_interests_file
field_name: oe_person_interests_file
entity_type: node
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ dependencies:
third_party_settings:
composite_reference:
composite: true
composite_revisions: true
id: node.oe_person.oe_person_jobs
field_name: oe_person_jobs
entity_type: node
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ dependencies:
third_party_settings:
composite_reference:
composite: false
composite_revisions: false
id: node.oe_person.oe_person_media
field_name: oe_person_media
entity_type: node
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ dependencies:
third_party_settings:
composite_reference:
composite: false
composite_revisions: false
id: node.oe_person.oe_person_organisation
field_name: oe_person_organisation
entity_type: node
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ dependencies:
third_party_settings:
composite_reference:
composite: false
composite_revisions: false
id: node.oe_person.oe_person_photo
field_name: oe_person_photo
entity_type: node
Expand Down
Loading

0 comments on commit 45e72f4

Please sign in to comment.