Details
-
Bug
-
Resolution: Done
-
High
-
None
Description
Bike tutorial:
document:https://doc.ez.no/display/DEVELOPER/Step+1+-+Display+content+of+a+Ride
1.Suggestions:
- Nice to have with the changes in platform instead of ezpublish 5.x example (also still work with platform)
- Changes was presented in eZConf2016-Paris
https://bdunogier.github.io/talks/ezconf2016-ezplatform-views/#/3/4
-> Changes in /src/AppBundle/Controller/RideController.php:
public function viewRideWithPOIAction(ContentView $view) { $repository = $this->getRepository(); $contentService = $repository->getContentService(); $currentLocation = $view->getLocation(); $currentContent = $contentService->loadContentByContentInfo( $currentLocation->getContentInfo() ); $pointOfInterestListId = $currentContent->getFieldValue('pois'); $pointOfInterestList = array(); foreach ( $pointOfInterestListId->destinationContentIds as $pointId ) { $pointOfInterestList[$pointId] = $contentService->loadContent( $pointId ); } $view->addParameters( [ 'pointOfInterestList' => $pointOfInterestList ] ); return $view; }
2. Error In section: "Add the Point Of Interest in the Ride full view"
-> The pointOfInterestList from the controller is an array and could not works with the logic to add just these lines at the end of the ride.html.twig
-> So to include the Points Of Interest in the ride template, We should include the point_of_interest.html.twig template and loop over the POI items.
{% for pointOfInterest in pointOfInterestList %} {% include 'AppBundle:line:point_of_interest.html.twig' with {content : pointOfInterest} %} {% endfor %}
3. Suggestion:
- it would be also nice to add new section to explain how to get POI from the ride twig Template without using the previous controller and to give the user the opportunity to discover the view controller using "ez_content:viewAction"
- The section to add in "Integrate the Points of Interest in the Ride view"
1. (Option1) Working with the view controller:
Add the following lines at the end of the Ride full view in "/app/Resources/views/full/ride.html.twig"
{% set contentIds = content.getFieldValue('pois') %} {% for contentId in contentIds.destinationContentIds %} {{ render( controller( "ez_content:viewAction", {'contentId': contentId, 'viewType': 'line' } ) ) }} {% endfor %}
Then check the Ride page again to see the Points of Interest !
2. (Option2) Create the RideController
-> Same article as :https://doc.ez.no/display/DEVELOPER/Step+1+-+Display+content+of+a+Ride (Create the RideController)
Attachments
Issue Links
- relates to
-
EZP-28100 As a user I can follow the bike tutorial without errors
- Closed