Skip to content
This repository has been archived by the owner on Feb 26, 2024. It is now read-only.

Placeholder slots cannot be defined programmatically #290

Open
markfinger opened this issue Aug 29, 2017 · 1 comment
Open

Placeholder slots cannot be defined programmatically #290

markfinger opened this issue Aug 29, 2017 · 1 comment

Comments

@markfinger
Copy link
Member

Fluent allows you to define placeholder slots via the get_placeholder_data hook on the admin class responsible for a page type. Unfortunately, the layout pages have a add_missing_placeholders hack that overrides it.

Background:

mark 
[9:46 AM] 
Does anyone know how to explicitly add placeholders to a page without relying on the `{% page_placeholder ... %}` being picked up?

Use-case is a placeholder that needs manual iteration of the content items to render a complicated grid layout. I'd prefer not bundle the grid markup and parent-introspection into the content item's template.

mark
[2:47 PM] 

Turns out that icekit prevents this from functioning.

You can define `get_placeholder_data` on a page type's `model_admin` class, but icekit's layout model will still defer to the rendered template.

This seems to be related to the `add_missing_placeholders` hack, which was added to handle additions of placeholders after a page had already been defined.

My hacky workaround is to call the `page_placeholder` tag, but wrap it in a HTML comment and then manually iterate over the child plugin instances.


james [2:50 PM] 
@mark I resorted to a similar nasty hack here: https://github.com/ixc/agsa/blob/develop/tarnanthi/templates/tarnanthi/layouts/event.html#L118 -- use the `page_placeholder` template tag, but tell it to render an empty HTML template (edited)


mark
[2:51 PM] 
Cool, your workaround saves rendering the plugin instances


james [2:52 PM] 
I was hoping you'd find the "There must be a better way" part of my TODO there...


mark
[2:52 PM] 
Yeah, similarly.


[2:53] 
I knew that I had previously found a workaround for this, but it looks like changes have occurred in icekit since then and there's no longer a reasonable way to do it.
@markfinger
Copy link
Member Author

cc @jmurty

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

No branches or pull requests

1 participant