Uploaded image for project: 'eZ Publish / Platform'
  1. eZ Publish / Platform
  2. EZP-26853

Feedback on Doc : Bike Tutorial

    XMLWordPrintable

Details

    Description

      Bike tutorial:

      document:https://doc.ez.no/display/DEVELOPER/Step+1+-+Display+content+of+a+Ride

      1.Suggestions:

      -> 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

        Activity

          People

            Unassigned Unassigned
            ramzi.arfaoui ramzi.arfaoui
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Time Tracking

                Estimated:
                Original Estimate - 3 days
                3d
                Remaining:
                Remaining Estimate - 3 days
                3d
                Logged:
                Time Spent - Not Specified
                Not Specified