- 🇨🇦Canada User Advocate
I've modified the patch from #9 to integrate a minor but necessary fix I did at https://www.drupal.org/project/linkit/issues/3422022 🐛 Title attribute shows html if any exists in the target node title Active
We have a bunch of area elements which are essentially anchor tags that allow clickable areas such as provinces or states (illustration below)
The content was migrated and the linkit attributes were added via script, that's when we noticed linkit didn't process area elements as expected. With that said, we will need an interface way to select creating an area link instead of an a anchor element. For now, we've created a patch that at least allows linkit to process area elements as expected.
HTML for an area tag with the href="..." replaced with the linkit information using the script above:
<area shape="poly" coords="95,142,103,265,235,296,236,249,184,228,154,180,160,163,204,196,225,76" href="/node/884" data-entity-substitution="canonical" data-entity-type="node" data-entity-uuid="44c47878-da27-4dfc-9676-c9553e7732f6" alt="Northwest Territories" title="Northwest Territories">
or import such code from another cms with code similar like this section:
// Obtain url of associated drupal node to reference.
foreach ($entity_ids as $id) {
$entity = Node::load($id);
$url = 'node/' . $entity->id();
$url = Url::fromUri("base://$url")->toString();
$str .= $url;
}
// Linkit set-up.
$linkit_attributes = ' data-entity-substitution="canonical"';
$linkit_attributes .= ' data-entity-type="node"';
$linkit_attributes .= ' data-entity-uuid="' . $entity->uuid() . '"';
Log::msg(' Repl: ' . $str . ' with linkit attrs' . $linkit_attributes);
return 'href="' . $str . '" ' . $linkit_attributes;
see the patch, which is a partial solution , adds area element processing correctly
review patch, in a future issue or patch, the option to select area element vs a anchor could be added, for starters lets add area processing
TBD
adds area element processing as if it was an anchor
N/A
Active
5.0
Code
The change is currently missing an automated test that fails when run with the original code, and succeeds when the bug has been fixed.
Not all content is available!
It's likely this issue predates Contrib.social: some issue and comment data are missing.
I've modified the patch from #9 to integrate a minor but necessary fix I did at https://www.drupal.org/project/linkit/issues/3422022 🐛 Title attribute shows html if any exists in the target node title Active