You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Here's an idea for a new feature:
Right now, one can either link to another internal page, OR to an anchor on the current page.
Many times we need to do both - link to an anchor on ANOTHER internal page. This could backend-wise easily be implemented by showing the link-internal field next to the link-anchor field:
We've solved this same thing by adding this in a DataExtension.
publicfunctionupdateCMSFields(FieldList$fields)
{
$fields->replaceField(
'Anchor',
TextField::create('Anchor', 'Anchor Link (without #)')
->displayIf('LinkType')->isEqualTo('anchor')->orIf('LinkType')->isEqualTo('internal')->end(),
);
}
publicfunctionupdateLink(&$link)
{
if ($this->owner->LinkType == 'internal') {
// Use absolute URL in case the reference is on another subsite$link = $this->owner->InternalLink()->AbsoluteLink();
// Add Anchor tag if added in custom field$link .= $this->owner->Anchor ? '#' . $this->owner->Anchor : '';
}
}
Would be great to have this integrated in the module.
Hi, thanks for this very useful plugin. :-)
Here's an idea for a new feature:
Right now, one can either link to another internal page, OR to an anchor on the current page.
Many times we need to do both - link to an anchor on ANOTHER internal page. This could backend-wise easily be implemented by showing the link-internal field next to the link-anchor field:
src/Forms/LinkItemField.php, Line 157+:
The final link could be something like:
/about-us/#map
src/Model/LinkItem.php, Line 178-180:
If you like, I can create a merge request. Not sure though if LinkItem->getCMSFields() needs to be adjusted, too. I'm fairly new to Silverstripe.
The text was updated successfully, but these errors were encountered: