Skip to content

Commit

Permalink
Merge branch 'release/1.4.5'
Browse files Browse the repository at this point in the history
  • Loading branch information
vincent-gao committed Nov 26, 2019
2 parents 1a24d31 + 7441dab commit 41858df
Showing 1 changed file with 22 additions and 0 deletions.
22 changes: 22 additions & 0 deletions tide_core.module
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ use Drupal\user\Entity\Role;
use Drupal\views\ViewExecutable;
use Drupal\workflows\Entity\Workflow;
use Drupal\Core\Form\FormStateInterface;
use Drupal\Core\Render\Markup;

/**
* Implements hook_views_data_alter().
Expand Down Expand Up @@ -189,3 +190,24 @@ function tide_core_entity_bundle_create($entity_type_id, $bundle) {
}
}
}

/**
* Implements hook_preprocess_HOOK().
*/
function tide_core_preprocess_status_messages(&$variables) {
if (isset($variables['message_list']['error']) && !empty($variables['message_list']['error'])) {
foreach ($variables['message_list']['error'] as &$error_message) {
if ($error_message instanceof Markup) {
$message = $error_message->__toString();
// We want to ensure that the error message to be altered under
// node edit context.
preg_match('/entity:node\/(\d+)/', $message, $matches);
// Checking that the error message comes from field_paragraph_link based
// on a node context.
if (strpos($message, 'Validation error on collapsed paragraph field_paragraph_link') !== FALSE && (isset($matches[1]) && is_numeric($matches[1]))) {
$error_message = t('A link in <i>Related links</i> field on this page is broken. Please update or remove the link and retry.');
}
}
}
}
}

0 comments on commit 41858df

Please sign in to comment.