New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
EZP-22550 Added breadcrumb to navigate in Demobundle #87
EZP-22550 Added breadcrumb to navigate in Demobundle #87
Conversation
$locationService = $this->getRepository()->getLocationService(); | ||
$path = $locationService->loadLocation( $locationId )->path; | ||
|
||
for ( $i = 1; $i < count( $path ); $i++ ) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
the root location can be configured at the siteaccess level, so you should loop until the configured root location.
This Pull Request does not respect our PHP Coding Standards, please, see the report below:
|
Modifications done. ping @dpobel |
This Pull Request does not respect our PHP Coding Standards, please, see the report below:
|
Not a single line of comment in your PR. The demo bundle is also here to tell people how to use the product. You should add some explanation here and there. |
ping @yannickroger |
* @param $locationId | ||
* @return \Symfony\Component\HttpFoundation\Response | ||
*/ | ||
public function viewBreadcrumbAction ( $locationId ) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
"viewBreadcrumbAction (" -> "viewBreadcrumbAction("
Hello, How is managed cache to breadcrumb ? and how it is invalid if content is updated? Thank. |
This Pull Request does not respect our PHP Coding Standards, please, see the report below:
|
@@ -298,4 +298,62 @@ public function viewStarRatingAction( Location $location ) | |||
); | |||
} | |||
|
|||
/** | |||
* Displays breadcrumb for a given locationId |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
"For a given $locationId"
And please fix the commit messages: "EZP-22550 Added breadcrumb to navigate in Demobundle" (typo + removed "impl/". |
What about caching, guys ? As far as I can tell, it should be tweaked through smart cache rules, depending on the breadcrumb's max depth, but I might be missing something. |
{ | ||
$location = $locationService->loadLocation( $path[$i] ); | ||
// if root location hasn't been found yet | ||
if ( $isRootLocation == false ) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nitpick: that's a bit weird, !$isRootLocation
is easier to grasp (IMHO)
besides the nitpick, it seems ok to me. For caching don't we need to use render_esi and to set the X-Location-Id header to the location id of the root location ? |
Well, the thing is that by default, I don't believe the cache rules will trigger cache clearing for a child location at depth 4 (it's just children by default, is it not ?). In any case, it's the DemoBundle. We can take care of caching later (and I believe we should) and merge it as is. |
@@ -43,3 +43,5 @@ services: | |||
class: %ezdemo.form.type.feedback.class% | |||
tags: | |||
- { name: form.type, alias: ezdemo_feedback } | |||
|
|||
white_october_breadcrumbs: ~ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This must not be here. This is semantic configuration so, should be either in ezpublish/config/config.yml
or in a configuration file loaded by this bundle, like for ez_comments.yml
.
As for caching, breadcrumbs are embedded in the main page and I'm not sure it worths it to use an ESI for that. So it would be expired with the current content. |
Wouldn't it be more correct, and more what legacy users would expect if it is esi, tied to menu root, so normal viewcache.ini tweaks applies? if tied to current content this is kind of not what user would expect at all, if viewcache.ini tied, it is more inline with how eZ Publish docs currently tells you to deal witch such cache. |
@andrerom In ezdemo legacy, we have the following: {cache-block keys=array( $module_result.uri, $user_hash, $extra_cache_key )} So it's completely bound to the current URI (and therefore content), and user hash of course. So for me expectations should be the same. |
true, so +1 from here then |
on the cache thing: if the breadcrumb is tied to the page/content (ie not in an ESI), does not that mean that if for instance I rename the parent content, the breadcrumb will be wrong as the child pages cache will probably not be cleared ? Given the cache-block example, I guess it's the same in legacy, so we can live with that for now, but this might be considered as a quite annoying bug. So +1 |
Yes @dpobel you're right. |
…_naviguate_in_DemoBundle EZP-22550 Added breadcrumb to navigate in Demobundle
Description
The goal here was to add a breadcrumb to be able to naviguate in the Demobundle. For that I implemented a new bundle from white october named BreadCrumbsBundle ( see link to whiteoctober bundle ).
To work this bundle need to be registred in ezPublishKernel.php and in composer.json ( see link to ezpublish-community pull request ).
Links
Jira : https://jira.ez.no/browse/EZP-22550
Whiteoctober BreadCrumbsBundle : https://github.com/whiteoctober/BreadcrumbsBundle
Ezpublish-community pull request link : ezsystems/ezpublish-community#150
Screenshot