Skip to content


Implement a way to get an app name in which placeholder is used #793

mitar opened this Issue · 8 comments

5 participants


Implement a way to get an app name in which placeholder is used. Currently there is no generic way to retrieve which app is using a placeholder.


Correction: Implement a way to get an app name in which the plugin is used, since each apphook can be connected to a different page per language, and placeholders has no language.


Not sure I understand this fully. What exactly do you want, how should the API look like and what's the use case?


Concrete thing: there is no generic way to get an absolute URL inside a plugin to a page (or something else) using this plugin. For example, in my plugin used in a cmsplugin-blog entry model I would like to know in which entry my plugin is used so that I could get an absolute URL back to it displayed.

Now, I could traverse hierarchy and get to the placeholder. The problem is that placeholder is not necessary in a page. If it is, then it is simple. But if it is not, then you have to find which model it is connected with. Even if you manage this (by traversing all *_set fields) you have a problem that sometimes it is not enough to get an absolute URL. For example, in cmsplugin-blog you get Entry model, but absolute_url is defined with a related model EntryTitle.

So the idea was that it would be much easier if you would be able to get application directly. Then you would know which field set to search for. Or even this app could have some new method defined to help you with that. So currently there are better API for using plugins/placeholders outside of the pages missing.


Where would you expect to see this API exposed, if it were possible? How are you looking to use it?
Would it be a method on CMSPluginBase, or a param passed to render, or added to the context via a plugin context processor?

Is this functionality exclusively for external apps (PlaceholderFields outside of the Page model, and app hooks), or is it something you think needs addressing because it's affecting your ability to work with CMS pages?


There is the UNDOCUMENTED and INTERNAL API to get the (first) attached model: which could be used to get the app name.

Note that there's no way this will become a public API in 2.2, if you do use it, you do so at your own risk and the chance that this API changes/breaks is there.


Yes, but even getting model is not enough (read above about cmsplugin-blog). This should be something plugins would provide. I think kezabelle's ideas for API are good. I am not sure what would be best. Probably a method to CMSPluginBase would be the most extendable and parameter passed to render easiest to implement.

I explained above how I am planing to use it. For links pointing to the URL back. For example, I made a Trac wiki markup plugin and there you can specify a link back to the page [. this page]. The problem is, that I cannot know the URL of this page in the plugin.

This functionality should be supported both for external apps (where no workaround exists) and for pages (where you can play a little and get this information). As plugins can be used in placeholder which are not used in pages I think this should be solved generally.


"parameter passed to render easiest to implement." wrong. Since that breaks a public API I really don't like this idea.


-1 as well

@FinalAngel FinalAngel closed this
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.