Partials and sections¶
Partials¶
By default the extension uses only two different partials to render the picture credits.
Partial "Default"¶
This partials renders every section, where a value is entered. It works best with all of the CC-licenses or similar.
3<f:render partial="Picturecredits/PartialSections" section="collection" arguments="{_all}"/>
4<f:render partial="Picturecredits/PartialSections" section="pictureLink" arguments="{_all}"/>
5<f:render partial="Picturecredits/PartialSections" section="publisherName" arguments="{_all}"/>
6<f:render partial="Picturecredits/PartialSections" section="creatorLink" arguments="{_all}"/>
7<f:render partial="Picturecredits/PartialSections" section="vendorLink" arguments="{_all}"/>
8<f:render partial="Picturecredits/PartialSections" section="licenseLink" arguments="{_all}"/>
9<f:render partial="Picturecredits/PartialSections" section="disclaimer" arguments="{_all}"/>
10<f:render partial="Picturecredits/PartialSections" section="additionalInfo" arguments="{_all}"/>
Partial "Allrightsreserved"¶
The second partial matches most of the stock photos.
It renders only part of the sections and inserts the Copyright Sign. The sections collection
and publisherName
are only required in the rarest cases. So if you do not need them,
delete the lines concerned or better, just create a new partial without them.
3<f:render partial="Picturecredits/PartialSections" section="collection" arguments="{_all}"/>
4<f:render partial="Picturecredits/PartialSections" section="pictureLink" arguments="{_all}"/>
5©
6<f:render partial="Picturecredits/PartialSections" section="publisherName" arguments="{_all}"/>
7<f:render partial="Picturecredits/PartialSections" section="creatorLink" arguments="{_all}"/>
8<f:render partial="Picturecredits/PartialSections" section="vendorLink" arguments="{_all}"/>
Sections¶
Below is the example for the section vendorLink
.
64<f:section name="vendorLink">
65 <f:variable name="selectSeparator">
66 {f:if(condition: '{resolvedTerms.vendorName} == stock.adobe.com || {resolvedTerms.vendorName} == Fotolia.com', then: '-', else: '/')}
67 </f:variable>
68 <f:variable name="separatorTrue">
69 {f:if(condition: '{resolvedTerms.creatorName} || {resolvedTerms.creatorLink}', then: '{selectSeparator}')}
70 </f:variable>
71 <f:switch expression="{resolvedTerms.vendorLink}">
72 <f:case value = "">
73 <f:if condition="{resolvedTerms.vendorName}">
74 <f:then>
75 {separatorTrue}{resolvedTerms.vendorName}
76 </f:then>
77 </f:if>
78 </f:case>
79 <f:defaultCase>
80 <f:if condition="{resolvedTerms.vendorName}">
81 <f:then>
82 {separatorTrue}<f:link.external uri="{resolvedTerms.vendorLink}">{resolvedTerms.vendorName}</f:link.external>
83 </f:then>
84 <f:else>
85 {separatorTrue}<f:link.external uri="{resolvedTerms.vendorLink}">{resolvedTerms.vendorLink}</f:link.external>
86 </f:else>
87 </f:if>
88 </f:defaultCase>
89 </f:switch>
90</f:section>
First it is checked, which separator will be set. Fotolia
and AdobeStock need a -
instead of a /
. In the following variable it is checked, if
a separator is needed at all.
Tip
If you prefer another separator e.g. a ,
, you can change it in the sections.
But notice, that the separators are not only set in these variables. They are also hard coded in the
conditions.
The switch case verifies, which values are set. In the default case vendorName
refers to the
vendorLink
. The other case and conditions are fallbacks, if either vendorName
or
vendorLink
are not set.