- πΊπΈUnited States mark_fullmer Tucson
Thanks for the suggestion! After careful consideration, I do not think that a plaintext rendering when a node is unpublished is a standard convention, nor that it would be intuitive, nor that most content maintainers would want this behavior (they'd prefer a link that goes to a 403).
Therefore, I'm going to close this issue, as I do not see this feature being in the module's roadmap.
If more people in the community feel differently, I'm open to listening!
- πͺπΈSpain foreveryo
It would be great to have the option (on the linkit url converter filter) to enable this.
I think a behaviour that everyone can agree would be that if this new selector is selected that users without access to the unpublished content will just see the anchor text without any link html markup.
Example:
<p>Bla bla bla <a href="/url-to-link" data-entity-type="node" data-entity-uuid="2fd2a6d6-9e61-4d51-b916-6297f6ceebb1" data-entity-substitution="canonical" title="Title of the url">anchor text</a> bla bla bla.</p>
on users without unpublished view permission will just see:
<p>Bla bla bla anchor text bla bla bla.</p>
I've made a test (only for anonymous users) on my site modifying the LinkitFilter.php > process():
if(!$entity->isPublished() && \Drupal::currentUser()->isAnonymous()) { $element->removeAttribute('href'); // Create new element <span> $span = $dom->createElement('span', $element->textContent); // Copiar attributes from current element to the new span element foreach ($element->attributes as $attr) { $span->setAttribute($attr->name, $attr->value); } // Reemplazar link <a> with <span> $element->parentNode->replaceChild($span, $element); continue; }
The part copying the element attributes might be unnecessary.