Skip to content

Commit

Permalink
Merge pull request #163 from UN-OCHA/release-versions/v3.4.7
Browse files Browse the repository at this point in the history
release versions/v3.4.7
  • Loading branch information
berliner authored Nov 30, 2023
2 parents 9ff8691 + 425cf55 commit 9fa076b
Show file tree
Hide file tree
Showing 7 changed files with 170 additions and 119 deletions.
231 changes: 116 additions & 115 deletions composer.lock

Large diffs are not rendered by default.

18 changes: 17 additions & 1 deletion html/modules/custom/gho_footnotes/src/GhoFootnotes.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ public static function updateFootnotes($html, $build) {
$dom = Html::load($html);

$accumulator = [];
$accumulated = $build['#view_mode'] !== 'preview';
$accumulated = ($build['#view_mode'] ?? NULL) !== 'preview';

// Process the texts with footnotes.
foreach (iterator_to_array($dom->getElementsByTagName('gho-footnotes-text')) as $node) {
Expand All @@ -37,6 +37,22 @@ public static function updateFootnotes($html, $build) {
// Extract references.
$references = gho_footnotes_extract_references($node_inner_html);

// Cleanup faulty footnote links, things like '<a href="#_ftn1">[1]</a>
// where it should be just '[1]'.
$updated_html = FALSE;
$links = $dom->getElementsByTagName('a');
foreach ($links as $link) {
if (array_key_exists($link->nodeValue, $references)) {
$node_inner_html = str_replace($link->ownerDocument->saveXML($link), $link->nodeValue, $node_inner_html);
$updated_html = TRUE;
}
}

// Extract the references again to make the positions match again.
if ($updated_html) {
$references = gho_footnotes_extract_references($node_inner_html);
}

// Get the footnotes for this text element.
$footnotes = [];
$footnote_list_node = $dom->getElementById('gho-footnotes-list-' . $id);
Expand Down
22 changes: 22 additions & 0 deletions html/modules/custom/ncms_ui/src/Entity/Storage/ContentStorage.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,10 @@

namespace Drupal\ncms_ui\Entity\Storage;

use Drupal\Core\Entity\ContentEntityInterface;
use Drupal\Core\Entity\EntityInterface;
use Drupal\Core\Entity\EntityStorageException;
use Drupal\Core\Field\FieldDefinitionInterface;
use Drupal\ncms_ui\Entity\Content\ContentBase;
use Drupal\node\NodeInterface;
use Drupal\node\NodeStorage;
Expand Down Expand Up @@ -117,4 +119,24 @@ protected function doPostSave(EntityInterface $entity, $update) {
}
}

/**
* {@inheritdoc}
*/
protected function hasFieldValueChanged(FieldDefinitionInterface $field_definition, ContentEntityInterface $entity, ContentEntityInterface $original) {
// Work around an issue where field data of content with active
// translations sometimes doesn't save correctly when using the
// "Publish as correction" or "Publish as revision" submit buttons on the
// node edit form.
if ($entity instanceof ContentBase && $entity->getTranslationLanguages(FALSE)) {
// Always return TRUE if the content has translations. The reason is that
// hasFieldValueChanged() doesn't fetch the previous revisions field
// values and thus falsely reports the fields to not have changed,
// preventing the changes from beeing written to storage. The main issue
// is probably somewhere else, but returning TRUE here seems to fix the
// issue without further side effects.
return TRUE;
}
return parent::hasFieldValueChanged($field_definition, $entity, $original);
}

}
4 changes: 4 additions & 0 deletions html/modules/custom/ncms_ui/src/Form/ContentBaseFormAlter.php
Original file line number Diff line number Diff line change
Expand Up @@ -147,6 +147,7 @@ public function alterForm(&$form, FormStateInterface $form_state) {
'@type' => strtolower($entity->type->entity->label()),
]),
],
'#submit' => [],
];
break;

Expand All @@ -159,6 +160,7 @@ public function alterForm(&$form, FormStateInterface $form_state) {
'#ajax' => $ajax_confirm + [
'confirm_question' => $this->t('This will publish these changes as a correction to the currently published version, which will be entirely replaced. Are you sure?'),
],
'#submit' => [],
];
$form['actions']['publish_revision'] = [
'#type' => 'submit',
Expand All @@ -167,6 +169,7 @@ public function alterForm(&$form, FormStateInterface $form_state) {
'#ajax' => $ajax_confirm + [
'confirm_question' => $this->t('This will publish these changes as a new revision to the currently published version, which will remain publicly available as an earlier or original version. Are you sure?'),
],
'#submit' => [],
];
break;
}
Expand All @@ -176,6 +179,7 @@ public function alterForm(&$form, FormStateInterface $form_state) {
'#name' => 'save_draft',
'#value' => $this->t('Save as draft'),
'#ajax' => $ajax_confirm,
'#submit' => [],
];
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,10 @@
margin-top: 2rem;
}

.gho-achievement-list .field__item {
width: 100%;
}

@media (min-width: 504px) {
.gho-achievement-list .field__item {
flex: 0 0 calc((100% - 1rem) / 2);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,13 @@
.gho-achievement__icon {
order: -1;
height: 3rem;
margin-bottom: 1rem;
}

.gho-achievement__icon img {
width: auto;
height: 100%;
filter: invert(27%) sepia(9%) saturate(0%) hue-rotate(188deg) brightness(93%) contrast(80%);
}

.gho-achievement__title {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,10 +58,10 @@
position: relative;
}
.gho-story .media-caption {
padding: 1rem 0 0.5rem 0;
margin-bottom: 0.5rem;
border-bottom: 1px solid #fff;
margin-bottom: 2rem;
padding: 0.5rem 0;
color: #fff;
border-bottom: 1px solid #fff;
font-size: 0.75rem;
}
@media (min-width: 768px) {
Expand All @@ -87,6 +87,8 @@

/* Same font-size/line-height as caption. @see gho-caption */
.gho-story__source {
margin-top: 1rem;
padding-top: 1rem;
border-top: 1px solid #d8d8d8;
font-size: 0.75rem;
line-height: 1.25rem;
Expand Down

0 comments on commit 9fa076b

Please sign in to comment.