...
Localtab Group |
---|
Localtab |
---|
| Code Pro |
---|
language | js |
---|
title | flickr-templates/templates/components/flickr-image-simple.yaml |
---|
url | https://git.magnolia-cms.com/projects/DOCUMENTATION/repos/flickr-integration/browse/flickr-templates/src/main/resources/flickr-templates/templates/components/flickr-image-simple.yaml?at=master&raw |
---|
| |
|
Localtab |
---|
| Advanced Tables - Table Plus |
---|
heading | 0 |
---|
multiple | false |
---|
enableHeadingAttributes | false |
---|
enableSorting | false |
---|
class | m5-configuration-tree |
---|
enableHighlighting | false |
---|
| | |
| | flickr-templates:components/flickr-image-simple | | info.magnolia.flickr.templates.templates.components.FlickrImageSimpleModel | | freemarker | | /flickr-templates/templates/components/flickr-image-simple.ftl | | Flickr simple image | | true |
|
|
|
Dialog definition
A Dialog definition defines the edible content properties of a template.
...
Localtab Group |
---|
Localtab |
---|
| Code Pro |
---|
language | js |
---|
title | flickr-templates/dialogs/components/flickr-image-simple.yaml |
---|
linenumbers | true |
---|
url | https://git.magnolia-cms.com/projects/DOCUMENTATION/repos/flickr-integration/browse/flickr-templates/src/main/resources/flickr-templates/dialogs/components/flickr-image-simple.yaml?at=master&raw |
---|
| |
|
Localtab |
---|
| Advanced Tables - Table Plus |
---|
heading | 0 |
---|
multiple | false |
---|
enableHeadingAttributes | false |
---|
enableSorting | false |
---|
class | m5-configuration-tree |
---|
enableHighlighting | false |
---|
| | |
| | /flickr-templates/dialogs/common/common-actions | | | |
| | info.magnolia.flickr.browser.app.field.FlickrItemPreviewComponent | | flickr-browser | | info.magnolia.ui.form.field.definition.LinkFieldDefinition | | Flickr pic |
|
|
|
Note:
- Line 7: The field uses the
Javadoc |
---|
0 | info.magnolia.ui.form.field.definition.LinkFieldDefinition |
---|
rangeHigherVersion | 5.6 |
---|
className | info.magnolia.ui.form.field.definition.LinkFieldDefinition |
---|
renderType | asynchronous |
---|
|
for the class
. - Line 9: It references
flickr-browser
in the appName
. - Line 10, 11: It uses a custom
contentPreviewDefinition
. We will have a look at the contentPreviewClass
Javadoc |
---|
0 | info.magnolia.flickr.browser.app.field.FlickrItemPreviewComponent |
---|
|
later.
...
Here is the relevant freemarker script which renders the image.
Code Pro |
---|
language | xml |
---|
title | flickr-templates/templates/components/flickr-image-simple.ftl |
---|
url | https://git.magnolia-cms.com/projects/DOCUMENTATION/repos/flickr-integration/browse/flickr-templates/src/main/resources/flickr-templates/templates/components/flickr-image-simple.ftl?at=master&raw |
---|
|
|
Note: The template uses a Model class.
...
We use the model to load another Java bean which represents the Flickr picture. The model exposes this "photo bean" as a bean property.
Code Pro |
---|
language | java |
---|
title | info.magnolia.flickr.templates.templates.components.FlickrImageSimpleModel |
---|
linenumbers | true |
---|
sections | %%(public class)%% - |
---|
url | https://git.magnolia-cms.com/projects/DOCUMENTATION/repos/flickr-integration/browse/flickr-templates/src/main/java/info/magnolia/flickr/templates/templates/components/FlickrImageSimpleModel.java?at=master&raw |
---|
|
|
Note:
- The type of the bean property photo is com.flickr4java.flickr.photos.Photo (which is provided by the 3rd party library Flickr4java).
- Line 56: The model injects
Javadoc |
---|
0 | info.magnolia.flickr.app.flickrservice.FlickrService |
---|
rangeHigherVersion | 1.1 |
---|
className | info.magnolia.flickr.app.flickrservice.FlickrService |
---|
renderType | asynchronous |
---|
|
. - Line 61: Photo can be retrieved with FlickrService and the flickrPictureId which is stored on the content of the component.
...
Here we create a FlickrItemPreviewComponent
which displays a thumbnail and photo title.
Code Pro |
---|
collapseType | Classic |
---|
language | java |
---|
title | info.magnolia.flickr.browser.app.field.FlickrItemPreviewComponent |
---|
linenumbers | true |
---|
sections | %%(public class)%% - |
---|
url | https://git.magnolia-cms.com/projects/DOCUMENTATION/repos/flickr-integration/browse/flickr-browser/src/main/java/info/magnolia/flickr/browser/app/field/FlickrItemPreviewComponent.java?at=master&raw |
---|
|
|
To build the custom preview component extend
Javadoc |
---|
0 | AbstractContentPreviewComponent |
---|
rangeHigherVersion | 5.6 |
---|
className | info.magnolia.ui.form.field.component.AbstractContentPreviewComponent |
---|
renderType | asynchronous |
---|
|
: