- last update
over 1 year ago 76 pass, 1 fail
Lightning in v4.0.5 has added integration with the conflict module and I am currently using page manager in a distribution and have run into an issue that seems to have an ultimate root cause in Panelizer.
The source of the issue was in conflict.module calling the getRouteObject.
function conflict_entity_load(array $entities, $entity_type_id) {
// @todo decide whether this is the right place for storing a clone of the
// loaded entity. Another possible place would be the form state for the main
// entity and the field state for inline entities. The problem with the
// current solution is that even entities loaded e.g. for a non inline entity
// form widget will be cloned.
$route = \Drupal::routeMatch()->getRouteObject();
// The route object will not be present if the entity is being loaded before
// the routing has completed. This happens e.g. in
// Drupal\Core\ParamConverter\EntityConverter::convert(), therefore we have
// to check if the route object is not present that we are still in the
// browser. This is not a perfect solution as there will be cases where we
// will clone unnecessary the entity, but currently the most simple solution.
if ((is_null($route) && (php_sapi_name() != 'cli')) || $route && ($route_defaults = $route->getDefaults()) && isset($route_defaults['_entity_form'])) {
foreach ($entities as $entity) {
if ($entity instanceof ContentEntityInterface) {
$clone = clone $entity;
$entity->{EntityConflictHandlerInterface::CONFLICT_ENTITY_ORIGINAL} = $clone;
$serialized = serialize($clone);
$hash = $entity_type_id . '_' . $entity->id() . sha1($serialized);
$entity->{EntityConflictHandlerInterface::CONFLICT_ENTITY_ORIGINAL_HASH} = $hash;
\Drupal::keyValueExpirable('conflict_original_entity')
->setWithExpireIfNotExists($hash, $serialized, 86400);
}
}
}
}
Which was resulting in this error:
The website encountered an unexpected error. Please try again later.</br></br><em class="placeholder">Symfony\Component\Routing\Exception\MissingMandatoryParametersException</em>: Some mandatory parameters are missing ("user") to generate a URL for route "<current>". in <em class="placeholder">Drupal\Core\Routing\UrlGenerator->doGenerate()</em> (line <em class="placeholder">182</em> of <em class="placeholder">core/lib/Drupal/Core/Routing/UrlGenerator.php</em>).
The following patch fixes this problem.
Postponed: needs info
4.0
Code
Not all content is available!
It's likely this issue predates Contrib.social: some issue and comment data are missing.