Feature #5933

Optional section rendering

Added by Nathan L over 11 years ago. Updated over 9 years ago.

Status:
Accepted
Priority:
Should have
Category:
ViewHelpers
Target version:
-
Start date:
2010-06-18
Due date:
2010-06-25 (over 11 years late)
% Done:

20%

Estimated time:
2.00 h
Has patch:
No

Description

It would be nice to be able to make a section optional.

If a template does not define the "food" section, then the default food will be shown if optional is set:
<f:render section="food" optional="true">
<p>Default food: potato chips</p>
</f:render>

If a default value is not set, then it will render nothing:
<f:render section="food" optional="true" />

If optional="true" is not set, then an exception will be thrown. This is the normal behavior so nothing should change for anyone unless they add the optional parameter.


Files

optionalSection.patch (788 Bytes) optionalSection.patch Nathan L, 2010-01-08 16:34
#1

Updated by Sebastian Kurfuerst over 11 years ago

  • Status changed from New to Accepted
  • Assignee set to Sebastian Kurfuerst
  • Priority changed from Should have to Must have
#2

Updated by Sebastian Kurfuerst over 11 years ago

  • Due date set to 2010-06-25
  • Start date changed from 2010-01-08 to 2010-06-18
  • % Done changed from 0 to 20
  • Estimated time set to 2.00 h

need to write a selenium test for it.

#3

Updated by Sebastian Kurfuerst over 10 years ago

  • Tracker changed from Bug to Feature
  • Target version set to 1.0 beta 1
#4

Updated by Sebastian Kurfuerst about 10 years ago

  • Priority changed from Must have to Should have
  • Target version changed from 1.0 beta 1 to 1.0 beta 2
  • Has patch set to No
#5

Updated by Robert Lemke about 10 years ago

  • Target version changed from 1.0 beta 2 to 1.0.0
#6

Updated by Karsten Dambekalns almost 10 years ago

  • Target version changed from 1.0.0 to 1.1 beta 1
#7

Updated by Karsten Dambekalns almost 10 years ago

  • Target version changed from 1.1 beta 1 to 1.1
#8

Updated by Florian Carstens over 9 years ago

Wouldn't it be better if there were the possibility to check that the section's content is not empty?

<f:if condition="{section.sidebar}">
  <f:then>
    <f:render section="sidebar" />
  </f:then>
  <f:else>
    <p>I'm sorry, nothing here!</p>
  </f:else>
#9

Updated by Karsten Dambekalns over 9 years ago

  • Target version deleted (1.1)

Also available in: Atom PDF