Commit 7934467e authored by David Barbeau's avatar David Barbeau
Browse files

snippet Shady Desjardins

parent ba743eca
......@@ -181,6 +181,31 @@ Last modified date : <strong>$fileEntry.getModifiedDate()</strong>
```
<a id="dlfileEntry-shady"></a>
## Récupérer l'objet "DFileEntry" d'un élément document et média de type document
`$fileEntry` est l'élément de type "document_library"
`$fileFields` est la value de l'élément de type "document_library"
```html
## REF : https://docs.liferay.com/portal/6.2/javadocs-all/com/liferay/portlet/documentlibrary/asset/DLFileEntryAssetRenderer.html
#set($renderer = $entry.getAssetRenderer())
## DO NOT REMOVE THE RENDER CALL!
## THIS IS SHADY!
## By calling the renderer's "render" method, file entry and file version attributes
## are injected in the request.
#set($templatePath = $renderer.render($renderRequest, $renderResponse, "abstract"))
#set($fileEntry = $renderRequest.getAttribute("DOCUMENT_LIBRARY_FILE_ENTRY").getDLFileEntry())
#set($fileVersion = $renderRequest.getAttribute("DOCUMENT_LIBRARY_FILE_VERSION"))
#set($fileVersionId = $fileVersion.getFileVersionId())
#set($fileFields = $fileEntry.getFieldsMap($fileVersionId).values().iterator().next())
$fileFields.get('xxx').getRenderedValue($locale)
```
---
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment