- Created by Dominika Kurek, last modified by Sarah Haïm-Lubczanski on May 09, 2016
We will customize the Google map later, now let's inject and display all Points of interest within the view.
Points Of Interest
Go to Admin Panel > Content Types, and under the "Content" group, create the Point Of Interest Content Type.
Create the Point Of Interest (POI) Content Type
A geographical location rides go through. Each ride may be related to as many points of interest as needed.
Name: Point of interest
Identifier: point_of_interest
Content name pattern: <name>
Then create all fields with the following information:
- Name: identifier name; field type textLine (Required / Searchable / Translatable)
- Description: identifier description; field type Rich Text (Required / Searchable / Translatable)
- Photo: identifier image; field type Image (Required / Searchable)
- Legend: identifier legend; field type Rich Text (Required / Searchable / Translatable)
- Place: identifier place; field type MapLocation (Required / Searchable)
The content name pattern defines how the name and URL part of Content items of this type will be built. It may include static strings, as well as references to field definitions, using their identifier.
The value of the fields referenced in the pattern will be used to build the name. Most Field Types are able to render a textual representation of their value, but be aware that it is not implemented for some of them (Selection FieldType, Relation FieldType, RelationList FieldType).
Create some Points Of Interest in the Content tree. Note that you will need pictures (for the Photo, the image Field) to represent these Points Of Interest.
Edit the Ride Content Type
Now, validate and edit the Ride in order to add a Relation (multiple) between the two Content Types.
Then link some Points Of Interests to a Ride in the Admin interface.
Ride view
Display the list of POI
By default, there are only 4 variables in a view: noLayout, viewbaseLayout, content and location.
It is possible to inject whatever variable you want in a specific view.
You will find more info here: How to use a custom controller to display a content item or location and View provider configuration.
Add a new parameter to your override rule
We have already set an override rule for ContentType Ride and we will need to modify it to use our own action injecting the list of Point of interest content.
Create your Point of interest line view
Now, we need to create the line view for Point of interest.
Declare a new override rule into your app/config/ezplatform.yml
:
Create your template for the line view of a Point of interest app/Resources/views/line/point_of_interest.htm.twig
:
2 Comments
Kamil Ronewicz
Minor issues:
{#<
img
src
=
"images/lyon.png"
class
=
"img-responsive img-rounded"
alt
=
""
>#}
{#<
p
class
=
"padding-box text-justify"
></
p
>#}
Dovydas Baublys
Is it possible to get full ride template file ?