Skip to content
Snippets Groups Projects
Commit a64486e4 authored by Gareth Poole's avatar Gareth Poole
Browse files

remove problematic update hook to linkit matcher

parent 4e0803db
No related branches found
No related tags found
No related merge requests found
......@@ -34,43 +34,4 @@ function sector_text_formats_install() {
$editor_role_object->save();
}
}
/**
* Implements hook_update_N().
*/
function sector_text_formats_update_9001() {
// The machine name of the Linkit profile you want to update.
$profile_id = 'sector_linkit';
// Load the Linkit profile configuration.
$config = \Drupal::configFactory()->getEditable("linkit.linkit_profile.$profile_id");
if ($config->isNew()) {
// If the profile does not exist, inform the user.
\Drupal::messenger()->addMessage(t('The Linkit profile %profile does not exist.', ['%profile' => $profile_id]), 'error');
return;
}
// Get the existing matchers.
$matchers = $config->get('matchers');
// Check if 'external' matcher is already in the profile.
if (!in_array('external', $matchers)) {
// Add 'external' matcher to the matchers array.
$matchers[] = 'external';
// Update the configuration with the new matchers array.
$config->set('matchers', $matchers);
// Save the updated configuration.
$config->save();
// Inform the user of the update.
\Drupal::messenger()->addMessage(t('The external matcher has been added to the Linkit profile %profile.', ['%profile' => $profile_id]));
}
else {
// Inform the user that the matcher already exists.
\Drupal::messenger()->addMessage(t('The external matcher is already present in the Linkit profile %profile.', ['%profile' => $profile_id]), 'status');
}
}
\ No newline at end of file
}
\ No newline at end of file
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment