So I needed something similar to the old DefaultPageParts extension
(which seems to be defunct), but I wanted to be able to define the
default page parts in a parent page that might already have another
page type, like Archive.
The following seems like a really bad idea to me:
Page.class_eval do
alias :original_parent_equals :parent=
def parent=(parent)
default_parts =
parent.render_part('default_child_page_parts').strip.split(/\s*,\s*/)
default_parts.each do |name|
self.parts << PagePart.new(:name => name, :filter_id =>
Radiant::Config['defaults.page.filter'])
end
original_parent_equals(parent)
end
end
Obviously this is really tightly coupled to Radiant internals. It
specifically depends upon how PageController assigns the parent page
when creating a new page, for example.
But it does work, so I'm using it for now. Anybody have any
recommendations for another approach? I put it into an extension
that's available on GitHub. I'm happy to accept patches.
http://github.com/santry/radiant-default-page-parts-extension
- Sean
--
Sean Santry
http://seansantry.com
_______________________________________________
Radiant mailing list
Post: [email protected]
Search: http://radiantcms.org/mailing-list/search/
Site: http://lists.radiantcms.org/mailman/listinfo/radiant