Feature #5933

Optional section rendering

Added by Nathan L over 5 years ago. Updated about 3 years ago.

Status:Accepted Start date:2010-06-18
Priority:Should have Due date:2010-06-25
Assigned To:Sebastian Kurfuerst % Done:

20%

Category:ViewHelpers
Target version:- Estimated time:2.00 hours
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.

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

History

#1 Updated by Sebastian Kurfuerst over 5 years ago

  • Status changed from New to Accepted
  • Assigned To set to Sebastian Kurfuerst
  • Priority changed from Should have to Must have

#2 Updated by Sebastian Kurfuerst about 5 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

need to write a selenium test for it.

#3 Updated by Sebastian Kurfuerst about 4 years ago

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

#4 Updated by Sebastian Kurfuerst almost 5 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 almost 4 years ago

  • Target version changed from 1.0 beta 2 to 1.0.0

#6 Updated by Karsten Dambekalns almost 4 years ago

  • Target version changed from 1.0.0 to 1.1 beta 1

#7 Updated by Karsten Dambekalns over 3 years ago

  • Target version changed from 1.1 beta 1 to 1.1

#8 Updated by Florian Carstens over 3 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 about 3 years ago

  • Target version deleted (1.1)

Also available in: Atom PDF