From: Eric F. <ef...@pl...> - 2008-08-05 15:34:37
|
As the element library I'm working on grows, it would be convenient to be able to better organize the elements that appear in the "Add Element" dropdown. What I would like to do is arrange them in optgroups. This currently isn't supported, but with a change to Krang::CGI::ElementEditor it could be. Currently, order_of_available_children returns an array of element names. To add optgroup support, we can have that method optionally return an array of hashrefs, structured like so: { optgroup => 'Meta Tags', elements => [qw( meta_description meta_keywords meta_title )], }, In Krang::CGI::ElementEditor's element_edit, we test the first element of the returned array, and if it is a hashref, we build the menu to include optgroups, otherwise, we do what we've been doing in the past. Attached is a screenshot of a sample optgrouped menu. Before checking this in, I just wanted to check with the group. Questions, comments? -- Eric Folley Plus Three, LP http://plusthree.com/ |