I applied the hook that Berdir shared in the first comment but I had to complement the solution by passing the entity id to the iframe controller, that way I was able to load the media entity data. In my case I added a custom field to my Remote Video media type to determine whether to replace youtube.com by youtube-nocookie.com or not.
use Drupal\media\IFrameMarkup;
/**
* Implements hook_preprocess_media_oembed_iframe().
*/
function mymodule_updates_preprocess_media_oembed_iframe(array &$variables) {
if (strpos((string) $variables['media'], 'youtube.com') !== FALSE) {
$entity_id = $variables['entity_id'];
$remote_video = \Drupal::entityTypeManager()->getStorage('media')->load($entity_id);
$no_cookies = $remote_video->get('field_nocookies')->value;
if ($no_cookies) {
$variables['media'] = IFrameMarkup::create(str_replace('youtube.com/', 'youtube-nocookie.com/', $variables['media']));
}
}
}
I applied the patch and after a few days of testing the team found that the charts don't reflect the current trainings, I found that the patch considered the "completed" day although this is field calculated based on the "status" parameter.
Not sure if the patch was created properly but at least I hope this helps to someone else with similar issues.
BTW thanks so much for the patch, it literally saved my day.
I have placed strrpos params wrong, patch was updated.
Based on my previous comment I've created this patch.
Complementing #12
In addition to performance issues, I got duplicated rows in different views, for example, I got duplicated results after filtering users by mail in /admin/people.
I would recommend validating the database type before doing the CAST, since this only happens with "pgsql", then validate the type of the field (if entity type exists) and validate if the field doesn't have "id" as sub-string (assuming all ids are INT)
I solve my specific issue with this https://www.drupal.org/project/flag/issues/2929733#comment-12836956 π SQL query error on PostgreSQL 9.5 when try to list Bookmarks Active
I got the same error with group and webform modules when you assign one of the element to the form as a group entity.
#6 works for me.
I also applied #9, the one that was posted for the core, but I got duplicated rows in different views, for example, I got duplicated results after filtering users by mail in /admin/people.
Thanks for the quick response and feedback on comment #4, I already created the bug in the module.
luisnicg β created an issue.
luisnicg β created an issue.
The patch works perfectly with ::loadByProperties() as it expects and array as value ββand will add IN operator, in my case I am facing the same problem using ::entityQuery(), being more specific, I'm working with the menu_export module (and PostgreSQL of course) and it has this query:
$menuLinkEntity = \Drupal::entityQuery('menu_link_content')
->accessCheck(FALSE)
->condition('uuid', $menu['uuid'])
->execute();
Where $menu['uuid'] is an array of values.
The problem with this is that the condition operator is not defined, and when the translateCondition() is executed, it didn't add the operator, which should be "IN", causing this error:
SQLSTATE[42601]: Syntax error: 7 ERROR: syntax error at or near "("
LINE 5: WHERE (LOWER("menu_link_content"."uuid") (LOWER('XXXXX
Not sure if it should be a core or module issue, I added a patch that worked for me.
I didn't have enough time to add a test, it would be something like this:
$node1 = $this->drupalCreateNode([
'type' => 'page',
'field_first' => '1234',
'field_second' => 'test_value_1',
]);
$nodes = $this->container->get('entity_type.manager')->getStorage('node')->getQuery()->condition('uuid',[$node1->uuid()])->execute();
// @todo validate results
luisnicg β created an issue.