\\change30\alainflou\modules\project\persistentdocument\frame.class.php
1 2 3 4 5 6 7 |
/** * @return string[] */ public function getPublishedDeclinationColorsCode($shapetype = null, $shop = null) { return project_FrameService::getInstance()->getPublishedDeclinationColorsCode($this, $shapetype, $shop); } |
\\change30\alainflou\themes\responsive\modules\project\templates\Project-Block-ProductItem-List.all.all.html
1 |
<p>${php: var_dump(product.getDeclinedproduct().getPublishedDeclinationColorsCode())}</p> |
1 2 3 4 5 6 7 |
<ul class="product-declination-colors"> <tal:block tal:repeat="colorID product/getDeclinedproduct/getPublishedDeclinationColorsCode"> <li> <i class="icon color-${colorID}" /> </li> </tal:block> </ul> |
Récupérer une propriété contenue dans un objet
Dans Change, chaque module a un dossier persistentdocument/
. Ce dossier contient un ou plusieurs fichiers XML listant un ensemble de propriétés contenues dans un objet.
Par exemple, dans /modules/parking/persistentdocument/parking.xml
, sont listées toutes les propriétés de l’objet parking
:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 |
<?xml version="1.0" encoding="utf-8"?> <document xmlns="http://www.rbs.fr/schema/change-document/1.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.rbs.fr/schema/change-document/1.0 http://www.rbschange.fr/static/schema/change-document/3.5.xsd" model-version="3.5" has-url="false" use-rewrite-url="false"> <properties> <add name="code" type="String" min-occurs="1"/> <add name="nom" type="String"/> <add name="picto" type="modules_media/media"/> <add name="libelle" type="String" localized="true"/> <add name="ferme" type="Boolean"/> <add name="message" type="String" localized="true" db-size="100"/> <add name="devise" type="modules_list/item" min-occurs="0" max-occurs="1" from-list="modules_parking/devise"/> <add name="pourcentagevert" type="Integer" min-occurs="1" default-value="20"/> <add name="pourcentageorange" type="Integer" min-occurs="1" default-value="80"/> <add name="duree" type="Integer"> <constraints>min:-1</constraints> </add> <add name="handicape" type="Integer"/> <add name="occupation" type="Integer"/> <add name="maximum" type="Integer"/> <add name="mode" type="Integer"/> <add name="libre" type="Integer"/> <add name="etat" type="Integer"/> <add name="display" type="Integer" default-value="0" from-list="modules_parking/parkingdisplay" localized="true"/> </properties> <statuses default="PUBLICATED"/> <serializedproperties> </serializedproperties> </document> |
Si, dans mon template de bloc, je souhaite récupérer l’information de nom
de l’objet parking
, je procède comme suit :
1 2 3 |
<tal:block tal:repeat="parking parkings"> <p>${parking/getNom}</p> </tal:block> |