- 🇩🇪Germany Anybody Porta Westfalica
Follow-up: ✨ Pre-check contextual link ("contextual_links()" format Active
We got an:
Notice: Undefined offset: 2 in _contextual_id_to_links() (line 213 in /web/core/modules/contextual/contextual.module).
If we use it like this:
{{ contextual_links('block_content:block_content=' ~ block_id) }}
It works fine, but the notice appears randomly.
This is the function throwing the error:
/**
* Unserializes the result of _contextual_links_to_id().
*
* Note that $id is user input. Before calling this method the ID should be
* checked against the token stored in the 'data-contextual-token' attribute
* which is passed via the 'tokens' request parameter to
* \Drupal\contextual\ContextualController::render().
*
* @param string $id
* A serialized representation of a #contextual_links property value array.
*
* @return array
* The value for a #contextual_links property.
*
* @see _contextual_links_to_id()
* @see \Drupal\contextual\ContextualController::render()
*/
function _contextual_id_to_links($id) {
$contextual_links = [];
$contexts = explode('|', $id);
foreach ($contexts as $context) {
list($group, $route_parameters_raw, $metadata_raw) = explode(':', $context);
parse_str($route_parameters_raw, $route_parameters);
$metadata = [];
parse_str($metadata_raw, $metadata);
$contextual_links[$group] = [
'route_parameters' => $route_parameters,
'metadata' => $metadata,
];
}
return $contextual_links;
}
Fixed
3.0
Code
Not all content is available!
It's likely this issue predates Contrib.social: some issue and comment data are missing.
Follow-up: ✨ Pre-check contextual link ("contextual_links()" format Active