Skip to content

Commit

Permalink
title: convert html entities d8-2280
Browse files Browse the repository at this point in the history
  • Loading branch information
protitude committed Nov 21, 2024
1 parent b846d04 commit 39a6603
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions infrastructure_news.module
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,11 @@ use Drupal\node\Entity\Node;
*/
function infrastructure_news_entity_presave(EntityInterface $entity) {
if ($entity->getEntityTypeId() == 'node' && $entity->bundle() == 'infrastructure_news') {
// If title has html entity, run html_entity_decode on it.
$title = $entity->get('title')->value;
if (html_entity_decode($title) != $title) {
$entity->set('title', html_entity_decode($title));
}
// Get value of field_affected_resources_txt and use that to set the value
// on field_affected_infrastructure.
$affected_resources = $entity->get('field_affected_resources_txt')->getValue();
Expand Down

0 comments on commit 39a6603

Please sign in to comment.