Kiren S
Kiren S

Reputation: 3097

Symfony include_component()

In Symfony I have a line include_component('core', 'ohrmList'); that prints a table. But I am unable to find the for loop that generates the table.

I want some conditional formatting on the table. Should I go and edit in exact for loop or is there any way to do this?

Upvotes: 0

Views: 3658

Answers (3)

Omar Alves
Omar Alves

Reputation: 763

You can format component output based on values passed to it.

For example, you can render you view with

include_component('core', 'ohrmList', array('name' => 'Maria', 'status' => 'approved') )

and in _ohrmList.php you can do something like

<?php echo $name ?> - <?php if ( $status == 'approved' ): ?>congrats, you were approved!!!<?php endif; ?>

Upvotes: 2

Michal Trojanowski
Michal Trojanowski

Reputation: 12322

Components are like "little" controllers. Their goal is pretty much the same as partials' but you use components when you need to do some extra action which would normally not fit into the view layer (e.g. a database call, some complicated computations etc.).

You can find the functions of the components in your module's actions directory in the components.class.php file.

Each component renders a partial named after its' own name. So the ohrmList component will render the _ohrmList.php partial after running the executeOhrmList() function.

In your case you should look inside the core module.

Upvotes: 2

denys281
denys281

Reputation: 2014

You can read about components here Chapter 7 - Inside The View Layer

I think you must find module core, and in templates folder,file _ohrmList.php

Upvotes: 3

Related Questions