Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Dropdown for choosing an anchor #10

Open
wernerkrauss opened this issue May 10, 2019 · 4 comments
Open

Dropdown for choosing an anchor #10

wernerkrauss opened this issue May 10, 2019 · 4 comments

Comments

@wernerkrauss
Copy link

When linking to a page in the CMS it would be handy to choose from the existing anchors in a dropdown.

I think I've seen this in the TinyMCE link widged.

@wernerkrauss
Copy link
Author

Related issue: silverstripe/silverstripe-cms#2440

@gorriecoe
Copy link
Contributor

@wernerkrauss I have been thinking about this and my ideal solution would be to add a field to Sitetree that stores a serialized list of anchor. These anchors can then be registered by some sort of method i.e addExtraAnchor('nameHere') on SiteTree. Then with a getter i.e getAnchors() I could get a list of anchors and put them in a dropdown. This means that anchors from modules such as Elemental could be listed. Sitetree could use beforeWrite to check the content field and register anchors found in the field.

@GuySartorelli
Copy link
Contributor

There is already a ticket raised in Elemental to get it to work with the existing anchor link functionality in SilverStripe - I recommend against making a workaround for modules which don't use the existing anchor extension point.
Anchors on a page can already be accessed using getAnchorsOnPage which already has an extension point updateAnchorsOnPage.

@wernerkrauss
Copy link
Author

The issue @GuySartorelli talked about is now solved and ready to use ;) silverstripe/silverstripe-elemental#186

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants