stephpy / timeline-bundle

Symfony2 bundle to make timeline
192 stars 57 forks source link

Accessing raw component info without calling timeline_component_render #160

Closed smarques closed 10 years ago

smarques commented 10 years ago

Hi, I am wondering if there is a way in twig when displaying a timeline, to access some of the component data without having to call the full timeline_component_render. For example sometimes I have a complex layout where I would display just the subject name first, then verb, then below a full subject render. Is there a way to get the component data as a variable? something like set data = timeline.getComponentData('subject')

Once again, thank you so much :)

mpclarkson commented 10 years ago

This works for me:

 {% for action in timeline %}

 {% set subject = action.getComponent('subject').data %}

// Your code here using the subject object... 
// e.g. Firstname: {{ subject.firstname }} etc

{% endfor %}
stephpy commented 10 years ago

Hi,

Can't say better than @mpclarkson :)

smarques commented 10 years ago

Thank you both, great!