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

custom positon in the page? #8

Open
karfau opened this issue Mar 15, 2018 · 2 comments
Open

custom positon in the page? #8

karfau opened this issue Mar 15, 2018 · 2 comments

Comments

@karfau
Copy link
Contributor

karfau commented Mar 15, 2018

I have been trying to wrapy head around what I would need to do to put the snippet rendered by your plugin into a different place in my DOM. But I do not have enough knowledge about the internals of Grav to figure it out.

I like that the logic behind the button is encapsulated in a plugin.
The most simple use case is that I want to position it relative to some element that is not body.

Do you have any idea how the current logic could be used and at the same time the developer (or the theme) could decide/configure where the code would be injected?

The default could still be the injection you are doing now, but maybe with another config toggle the control can be given yo the theme?

If there is a way to do that I'm willing to implement it. But I'm currently out of ideas/knowledge.

@enovision
Copy link
Owner

@karfau If the administrator that installs the plugin knows the element ('id') where this element should be injected to then I could see if I can have that done. I need an 'id' element instead of a 'class' element, for I will require an unique position somewhere in the DOM. It would then be injected at the top of that element. If the element would not exist, it would still do the default action, that would be what it is doing currently.

Is that what you have in mind?

@karfau
Copy link
Contributor Author

karfau commented Mar 15, 2018

I think that would do the trick,
I was thinking something like "there must be a better way", like a way that grav would provide, but in the slack channel I didn't get any answer that helped.
I guess since the themes are in full control of rendering the page, there is not much a plugin can do.

Might it be possible to add the data needed for a special key in the page and find a way for the theme to render your twig template with that data?

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

2 participants