I don't see anywhere in ui or in code to limit allowed layouts by role. Ideally this could be done on a layout category basis.
The obvious use case is to limit users to only being able to pick certain layouts (especially useful for IPE).
Rather than patch IPE (which would be easy; but i dont think Earl would accept the patch for this); i thought i would see if i could do it via hooks outside of panels. Seemed like it should be pretty simple.
First step was to create perms for each Category: http://screencast.com/t/PbBy4HLG8ZF
then i figured all that was left was to form_alter the layout selector form and alter the Category selections.
but sadly.. form_alter doesn't get called from this form. Sorry, i am not great with oop; but is this the reason for this? i can see the form is using formapi, so not sure why it is not alterable. perhaps i need to create class files and do a new panels_layout_ui->edit_form() function override? so looking for forward to D8.. not!! lol
Comments
Comment #1
liquidcms CreditAttribution: liquidcms commentedahh, no, my bad.. it is not the panels_layout_ui->edit_form() function that creates this form it is the std panels_common_print_layout_links() function which builds the form but then calls drupal_render immediately; so no chance to alter. :(
Comment #2
lsolesen CreditAttribution: lsolesen commentedSeems to be a duplicate of #2087119: is there a module to limit layouts and content pane categories by role. If it is not, please reopen.
Comment #3
lsolesen CreditAttribution: lsolesen commentedThis should be left open, as it is a feature request. I will close the support request instead.
Comment #4
jenlamptonIf you are using panelizer the allowed content can also be customized at admin/config/content/panelizer/node/TYPE/allowed
Comment #5
mglamanCurrently the alternative is to build your own renderer and override methods which contain logic on what are the allowed layouts.
Comment #6
PieterDCThis poorly documented feature may help you: implement hook_panels_layouts_available_alter($layouts).
Thanks to #2259957: Let other modules filter the available layouts in panels_ipe