- π©πͺGermany Anybody Porta Westfalica
Could we turn this into a MR so that we can get this fixed? In general this LGTM! Test was added.
In many areas of the module an item id is formed using [entity_type]:[entity_id]. To handle this, there are variations on the following code:
list($entity_type, $entity_id) = explode(':', $item);
return \Drupal::entityTypeManager()->getStorage($entity_type)->load($entity_id);
The issue I have is that I have custom entities that use colons in their ids, so the explode command is returning a partial entity id.
The patch I am submitting tweaks the explodes to limit them to two items like this:
list($entity_type, $entity_id) = explode(':', $item, 2);
return \Drupal::entityTypeManager()->getStorage($entity_type)->load($entity_id);
It's certainly an edge case, but a simple fix. There are other explode calls in the module that do similar things, such as the following, but I left them alone. Perhaps we should limit those as well?
if (!empty($values['view'])) {
list($view_id, $display_id) = explode('.', $values['view']);
$this->configuration['view'] = $view_id;
$this->configuration['view_display'] = $display_id;
}
And
// Remove weight of entity being removed.
foreach ($entity_ids as $entity_info) {
$entity_id_info = explode('_', $entity_info['entity_id']);
$form_state->unsetValue([
'selected',
$entity_info['entity_id'],
]);
// Remove entity itself.
$selected_entities = &$form_state->get(['entity_browser', 'selected_entities']);
unset($selected_entities[$entity_id_info[2]]);
}
Needs work
2.0
Miscellaneous
Not all content is available!
It's likely this issue predates Contrib.social: some issue and comment data are missing.
Could we turn this into a MR so that we can get this fixed? In general this LGTM! Test was added.