Files
chill-bundles/src/Bundle/ChillMainBundle/Templating/Entity/ChillEntityRenderInterface.php

52 lines
1.2 KiB
PHP

<?php
declare(strict_types=1);
/*
* Chill is a software for social workers
*
* For the full copyright and license information, please view
* the LICENSE file that was distributed with this source code.
*/
namespace Chill\MainBundle\Templating\Entity;
/**
* Interface to implement which will render an entity in template on a custom
* manner.
*/
interface ChillEntityRenderInterface
{
/**
* Return the entity in a box.
*
* Example: return a person inside a box:
*
* ```html
* <span class="chill-entity">
* <span class="chill-entity__first-name">Roger</span>
* <span class="chill-entity__last-name">Dupont</span>
* </span>
* ```
*
* @param type $entity
*/
public function renderBox($entity, array $options): string;
/**
* Return the entity as a string.
*
* Example: returning the name of a person.
*
* @param object $entity
*/
public function renderString($entity, array $options): string;
/**
* Return true if the class support this object for the given options.
*
* @param type $entity
*/
public function supports($entity, array $options): bool;
}