Ticket #433 (closed enhancement: fixed)
Variants for Slots - Default value for allowed_variants should bean empty array
| Reported by: | johnnyoffline | Owned by: | tboutell |
|---|---|---|---|
| Priority: | major | Milestone: | 1.4.2 |
| Component: | apostrophePlugin | Version: | 1.4 |
| Keywords: | slots, variants, syntax | Cc: | agilbert, rickybanister, jake, dordille, geoffd, boutell, johnnyoffline |
| Symfony version: | 1.4 |
Description
First, I have to say Variants are awesome. They offer a level of flexibility with such minimal overhead for implementation, it's awesome. love it love it.
BUT, All this awesomeness has to come with some kind of catch right?,
In practice, if you have one or two variants for a single slot and it's OK if that custom functionality ripples throughout every template throughout an entire site, the we're OK.
BUT, as soon as you have variants for 4 slots and 6 templates, and you want to allow or more importantly DISALLOW certain variants in some templates vs. another, you find yourself pasting this, ALOT:
'allowed_variants'=> array()
Example Slideshow Slot with Variants:
slot_variants:
aSlideshow:
normal:
label: Normal
options:
interval: 0
title: false
description: false
arrows: true
autoplay:
label: Auto Play
options:
interval: 6
title: true
description: false
arrows: true
full:
label: Full Info
options:
title: true
description: true
arrows: true
inset_left:
label: Inset Left
options:
width: 200
height: 130
resizeType: c
flexHeight: false
interval: 6
arrows: false
title: false
description: false
inset_right:
label: Inset Right
options:
width: 200
height: 130
resizeType: c
flexHeight: false
interval: 6
arrows: false
title: false
description: false
callout:
label: Call Out
options:
width: 345
height: 260
resizeType: c
flexHeight: false
arrows: true
title: true
description: true
Across six templates, I have to disallow all of these variants first, then selectively turn on which variants I want to allow the editor access to.
Now Take the above app.yml snippet and extrapolate it across 4 or 5 slots, aImage, aVideo, aPDF, aSlideshow, aButton.
Then implement this into 2 or 3 Areas in a single template.
Then do it in the 6 page templates a modest sized site uses.
That's a lot of typing just to have the ability to create a few variants and say this one specific spot can use this one specific customization.
The end result is, creating variants and having them automatically enabled blows up a lot of stuff. I should be able to create my variants and selectively sprinkle them around, only granting slots access to them.
Otherwise, you end up with area calls in a template that look like this:
<?php a_area('body', array(
'allowed_types' => array(
'aRichText',
'aSlideshow',
'aVideo',
'aImage',
'aFeed',
'aPDF',
'aButton',
'aText',
'aRawHTML',
),
'type_options' => array(
'aRichText' => array('tool' => 'Main'),
'aSlideshow' => array("width" => 480, "flexHeight" => true, 'arrows' => true, 'constraints' => array('minimum-width' => 480), 'allowed_variants'=> array()),
'aVideo' => array('width' => 480, 'flexHeight' => true, 'resizeType' => 's', 'allowed_variants'=> array()),
'aImage' => array('width' => 480, 'flexHeight' => true, 'resizeType' => 's', 'constraints' => array('minimum-width' => 480), 'allowed_variants' => array('normal','inset_left', 'inset_right')),
'aFeed' => array('allowed_variants'=> array()),
'aButton' => array('width' => 480, 'flexHeight' => true, 'resizeType' => 's', 'constraints' => array('minimum-width' => 480), 'allowed_variants'=> array()),
'aPDF' => array('width' => 480, 'flexHeight' => true, 'resizeType' => 's', 'allowed_variants'=> array()),
))) ?>
<?php a_area('sidebar', array(
'allowed_types' => array(
'aRichText',
'aSlideshow',
'aVideo',
'aImage',
'aFeed',
'aPDF',
'aButton',
'aText',
'aRawHTML',
),
'type_options' => array(
'aRichText' => array('tool' => 'Sidebar'),
'aSlideshow' => array('width' => 200, 'flexHeight' => true, 'resizeType' => 's', 'constraints' => array('minimum-width' => 200), 'allowed_variants' => array()),
'aVideo' => array('width' => 200, 'flexHeight' => true, 'resizeType' => 's', 'allowed_variants'=> array()),
'aImage' => array('width' => 200, 'flexHeight' => true, 'resizeType' => 's', 'constraints' => array('minimum-width' => 200), 'allowed_variants' => array()),
'aFeed' => array('allowed_variants'=> array()),
'aButton' => array('width' => 200, 'flexHeight' => true, 'resizeType' => 's', 'constraints' => array('minimum-width' => 200), 'allowed_variants'=> array()),
'aPDF' => array('width' => 200, 'flexHeight' => true, 'resizeType' => 's', 'allowed_variants'=> array()),
))) ?>
Lots of empty arrays.

