Enable selection of which panels area to use.

nedjo - May 14, 2007 - 21:40
Project:Panels Block
Version:5.x-1.x-dev
Component:Code
Category:feature request
Priority:normal
Assigned:recidive
Status:closed
Description

Currently the 'left' area is used for the panels block. It would be better to enable users to select which area to use. This is particularly an issue if new layouts are added that don't include left. (All current layouts do include it.)

#1

Wim Leers - May 17, 2007 - 14:18

By "users" you mean the "end-users", right? I.e. show multiple tabs, one for each area in the panel.

#2

nedjo - May 17, 2007 - 14:23

Actually, no, I mean site admins.

I hadn't thought of the idea of having each of the panels be a tab. That would be a separate feature request issue.

#3

recidive - May 18, 2007 - 21:32
Assigned to:nedjo» recidive
Status:active» needs review

Here is a patch that does this. It adds a select to the panels form where users can choose what panel area they want to expose as a block. The question I have in mind is how to do with backward compatibility. For now I've changed PANELS_BLOCK_AREA to PANELS_BLOCK_DEFAULT_AREA, so if a exposed block doesn't have an area set, it will use the default.

AttachmentSize
panelsblock_areas.patch 3.17 KB

#4

nedjo - May 18, 2007 - 21:46
Status:needs review» reviewed & tested by the community

Nice, this looks great!

A small suggestion before you apply this. We should use the default area as the default if it exists. Here's an untested idea:

<?php
    $options
= panelsblock_get_areas($form['layout']['#value']);

   
$form['panelsblock']['expose_area'] = array(
     
'#type' => 'select',
     
'#title' => t('Display area'),
     
'#default_value' => $blocks[$form['did']['#value']] && $blocks[$form['did']['#value']]['area'] ? $blocks[$form['did']['#value']]['area'] : (array_key_exists(PANELSBLOCK_DEFAULT_AREA, $options) ? PANELSBLOCK_DEFAULT_AREA : ''),
     
'#options' => $options,
     
'#description' => t('Select the area that will be displayed.'),
    );
?>

Then we don't need to justify the inclusion of this constant--it has a purpose beyond the update. Otherwise, we'd need an update that set the area for each existing registered panelsblock.

#5

recidive - May 18, 2007 - 22:04
Status:reviewed & tested by the community» fixed

Commited!

#6

Anonymous - June 1, 2007 - 22:31
Status:fixed» closed
 
 

Drupal is a registered trademark of Dries Buytaert.