Recent comments

🇩🇪Germany marcoka

Thank you Rik.
I will open a new branch in the next week and also publish a release for the current module i use on my pages.

🇩🇪Germany marcoka

i can confirm this. patch is not sufficient and causes a new problem with stray

tags.

🇩🇪Germany marcoka

Update with drupal 10.2 and Radix 5.0.11

This code will ad all classes in a second class tag.

{% if html_tag %}
  <{{ html_tag }}{{ attributes|without('id').addClass(classes)}}{{ attributes.setAttribute('id', clean_id) }}>
{% endif %}

Correct code:

{% if html_tag %}
  <{{ html_tag }} {{ attributes|without('id').addClass(classes).setAttribute('id', clean_id) }}>
{% endif %}
🇩🇪Germany marcoka

I can confirm #21 works here too with Drupal 10.2.4

🇩🇪Germany marcoka

Hi, thank you.
Hi no complicated workflow necessary. If this is only simple small api stuff we can discuss it here without patches and stuff. Saves a lot of time.

So you added that locally and that fixes the issue?

🇩🇪Germany marcoka

That memory error normally is because php has not enough memory. What do you use in your php config for memeory_size?

🇩🇪Germany marcoka

Yes, i think we can close this issue.

🇩🇪Germany marcoka

I can confirm this with
facets 2.0.7
pretty facet paths: 1.7

🇩🇪Germany marcoka

Thank you. has been pushed and i add it to the new 1.2.x

🇩🇪Germany marcoka

Don´t put so much work and effort in a readme of a beta module. The docs are not even solid yet.

🇩🇪Germany marcoka

I can not tell because i disabled the module. I am now on D10 with ckeditor 5.

🇩🇪Germany marcoka

Yes i have. My solution also works and you can customize the code to be valid with the schema.org gallery template

🇩🇪Germany marcoka

I started working on a D10 only version.
Token block 2 is required for that to work
Testing it currently and will report back.

🇩🇪Germany marcoka

Renamed to *.md.
As this is in development and changing the rest has to be postphoned until everything is stable and solid to document.

🇩🇪Germany marcoka

Hi. Thats a bit complex. I rewrote the image fields and added a custom textfield.
Also activate global script include in the settings and added a class to the view. "photoswipe-gallery"

image

<a class="photoswipe" href= "{{ field_media_image }}" itemprop="contentUrl"  data-pswp-width="{{ field_media_image__width }}" data-pswp-height="{{ field_media_image__height }}"  title="{{ field_media_image__title }}" alt="{{ field_media_image__title }}" data-overlay-title="{{ field_media_image__title }}">

custom textfield

<figure itemprop="associatedMedia" itemscope itemtype="https://schema.org/ImageObject">
{{ field_media_image_1 }}{{ field_media_image }}{{ field_media_image_2 }}{{ field_media_image_3 }}</a>
<figcaption itemprop="caption description pswp-caption-content">{{ field_media_image_4 }}{{ field_media_image_5 }}</figcaption>
</figure>

That results in the following on my site:
https://www.kopfhoerer-berater.de/test/sony-wf-1000xm5-im-test#image-gal...

🇩🇪Germany marcoka

@h1nds1ght did you only download the module put it into modules/custom an enabled it on the modules page?

🇩🇪Germany marcoka

I did use views "custom rewrite field" to build the markup myself. That works.

🇩🇪Germany marcoka

Just wanted to say that i am not really maintaining this module. Just no time. The second maintainer may take a look.

🇩🇪Germany marcoka

Thank you for the better Drupal-Way code :)

🇩🇪Germany marcoka

I think i found the solution.

At first we need event delegation. So we add the eventlistener on the container that always exists. The once is not applied to the listener but to the check of the length.

This way i can add or remove items of a list that are beeing added by a button add/delete

if (once('flagonce', '#produkt-vergleich', context).length) {
  flgContainer = document.getElementById("produkt-vergleich");

  flgContainer.addEventListener("click",function(e) {
    // e.target was the clicked element
    console.log("woo");
    console.log(e.target.closest("li"));

    if(e.target.closest("li")) {
      var closestli = e.target.closest("li");

      e.target.closest("li").remove();
      var clicked_id = closestli.getAttribute('data-nid');
      var node_name = closestli.getAttribute('data-nodename');
      var data = clicked_id + '::' + node_name;
      console.log("clicked icon  " + data);

      //set class of the add link to unflagged
      $(".jqflag[data-nid='" + clicked_id + "']").removeClass('flagged').addClass('unflagged');

      $(".jqflag[data-nid='" + clicked_id + "']").removeClass('flagged').addClass('unflagged');
      $(".jqflag[data-nid='" + clicked_id + "']").text("Hinzufügen");
      $(".jqflag[data-nid='" + clicked_id + "']").prepend(toggleIconAdd);

      flagList.remove(data);

      loadBlock();
    }

  });
}
🇩🇪Germany marcoka

Just to be sure the views code "$data['node_field_data']['computed_float']"

"computed_float" is not the name of the computed_field field you added using the ui?

When i add my field to views i get an error. I also have not achived to make my formatter avaliable in views. Its just avaliable when i add the field using layoit builder.

🇩🇪Germany marcoka

It is a plugin for computed field. Also pay attention to the hardcoded fieldname!

🇩🇪Germany marcoka

I think i already fixed the problems in code. The float problem, was my bad code. The tokens work using hook_token.
I will publish it in a second to a sandbox module.

🇩🇪Germany marcoka

Thank you all for the infos so far. I am working on an example where i add multiple int fields that will result in a float value.
The code works so far, but one thing confuses me. I don´t get it.

If i output the value it is always rounded down.
- I generate 5.3, the output is 5.0

<?php

namespace Drupal\computed_ratings\Plugin\ComputedField;

use Drupal\Core\Cache\CacheableMetadata;
use Drupal\Core\Entity\EntityInterface;
use Drupal\Core\Entity\EntityTypeInterface;
use Drupal\computed_field\Field\ComputedFieldDefinitionWithValuePluginInterface;
use Drupal\computed_field\Plugin\ComputedField\ComputedFieldBase;
use Drupal\computed_field\Plugin\ComputedField\SingleValueTrait;

/**
 *
 *
 * @ComputedField(
 *   id = "computed_ratings_field",
 *   label = @Translation("Computed Ratings Field"),
 *   field_type = "float",
 * )
 */
class ComputedRatingsField extends ComputedFieldBase {

  use SingleValueTrait;

  /**
   * {@inheritdoc}
   */
  public function singleComputeValue(EntityInterface $host_entity, ComputedFieldDefinitionWithValuePluginInterface $computed_field_definition): int {
     return (float) 5.3; 
  }
}
🇩🇪Germany marcoka

I use 5.x now too. I have no idea how to do a MR :(

🇩🇪Germany marcoka

I updated to mettag 2 and the matching schema org module using the composer command that was referenced in the update log.
Site is complete broken now.

  • drush cr has been done
  • complete restart of http server
  • complete system reboot
  • drush updb has been run

What caches could be cleaned else?
I have xdebug running. If i get some hints i can provide more information.

Mon Nov 20 14:29:40.710693 2023] [php:notice] [pid 6912] [client 127.0.0.1:59434] Uncaught PHP Exception ArgumentCountError: "Too few arguments to function Drupal\\metatag\\MetatagManager::__construct(), 9 passed in /srv/http/WORKSPACE_DRUPAL/EIGENE_PROJEKTE/PRODUCT_DISTRI_D12/web/core/lib/Drupal/Component/DependencyInjection/Container.php on line 259 and exactly 10 expected" at /srv/http/WORKSPACE_DRUPAL/EIGENE_PROJEKTE/PRODUCT_DISTRI_D12/web/modules/contrib/metatag/src/MetatagManager.php line 131

🇩🇪Germany marcoka

Applied #134 succesfully
I can "update" single items but the "update metadata" is not avaliable in the batch selection

🇩🇪Germany marcoka

Just wanted to say that i forked/hacked the module:

It now uses the local oembed thumbnail as a background image for the video. Tested with youtube.
That means absolutely ZERO cookies are set and it is DSGVO/GDPR compatible.
It also speeds up pageload and declutters the html code because the inner iframe code (huge html chunk) is ONLY loaded if the user clicks ok.

I can upload it here i a bit. I have not created any patches yet because i changed a lot of the js code and added some hooks.

🇩🇪Germany marcoka

I found a solution.

It can be done using 

hook_video_preprocess_field

Example

function gdpr_video_preprocess_field(&$variables) {
  $formatter = $variables['element']['#formatter'];

  if ($formatter === 'oembed') {
    /** @var \Drupal\media\Entity\Media */
    $media = $variables['element']['#object'];
    /** @var \Drupal\file\Entity\File */
    $thumbnail = $media->get('thumbnail')->entity;
    /** @var \Drupal\Core\File\FileUrlGeneratorInterface */
    $file_url_generator = \Drupal::service('file_url_generator');


    foreach (Element::children($variables['items']) as $item) {
//add the thumbnail as a data-attribute to the iframe
      if ($thumbnail_uri = $thumbnail->getFileUri()) {
        $thumbnail_path = $file_url_generator->generateString($thumbnail_uri);
        $variables['items'][$item]['content']['#attributes']['data-thumbnail'] = $thumbnail_path;
        $variables['items'][$item]['content']['#attached']['library'][] = 'gdpr/remote_video';
      }

      // Switch over the SRC attribute to be "data-src" so that iframe will not load external content
      $src = $variables['items'][$item]['content']['#attributes']['src'];
      $variables['items'][$item]['content']['#attributes']['data-src'] = $src;
      unset($variables['items'][$item]['content']['#attributes']['src']);

    }



  }
}
🇩🇪Germany marcoka

Just FYI if you switch to the nocookie domain cookies get still loaded, external fonts.
Even if you link the hir-es image from youtube directly cookies are set.
The only solutions seems to be to load and use the thumb oembed itself stores in the oembed folder in /files

🇩🇪Germany marcoka

bwaindwain, very interesting code. I played around with that a bit but couldnt see hwo it works.
The function "YOURMODULE_preprocess_field(&$variables) {" should render the thumbnail next to the video right?

🇩🇪Germany marcoka

I did some experiments with that code. It seems sometimes the video is still loaded even if the user does not click ok.
In that case you can "hear" it because its on autoplay.

🇩🇪Germany marcoka

Ok this is how you can achieve that.
I also switched the domain to cookieless "youtube-nocookie.com" in this example

  1. pd7_radix: is the themes name
  2. This code goes to the pd7_radix.theme
  3. Only works for oembed

function pd7_radix_preprocess_media_oembed_iframe(&$variables) {
// Pull iframe tag
$iFrame = $variables['media']->__toString();
// Switch domain to the youtube nocookie domain.
if (stripos($iFrame, 'youtube.com') !== false){
$newFrame = str_replace('youtube.com/', 'youtube-nocookie.com/', $iFrame);
$autoplay = str_replace('?feature=oembed', '?feature=oembed&autoplay=1', $iFrame);
$variables['media'] = IFrameMarkup::create($autoplay);
}
}

Using that the video will autoplay when you click ok.

🇩🇪Germany marcoka

Info for autoplay of youtube-videos taken from googles docs

To make an embedded video autoplay, add "&autoplay=1" to the video's embed code right after the video ID (the series of letters that follows "embed/"). Embedded videos that are autoplayed don't increment video views.

🇩🇪Germany marcoka

Thank you very much for the fast Info. Now i know it is by design and not my fault :D

🇩🇪Germany marcoka

Thank you very much, Rob. One more important module D10 ready.

🇩🇪Germany marcoka

Thank you. Unfortunatley i myself have never written a test and are also not familiar with the new ck5 :(

🇩🇪Germany marcoka

Ckeditor 5 and the core media embed using the ckeditor button.

🇩🇪Germany marcoka

Just wanted to mention that you can get the thumbnail from youtubes server like this: https://i.ytimg.com/vi/{videoID}/maxresdefault.jpg
Replace {videoID} with videoid

🇩🇪Germany marcoka

Yes i understand. The problem will be banner galore. Like every service creates it own banner?
One banner for adsense that is forced by google-monster. A second banner then is for general cookies.

I am thinkig about a good solution.

🇩🇪Germany marcoka

Thank you for the info.
Looks like another hurdle forced in and now actually force people into paid solutions?

🇩🇪Germany marcoka

Everything is fine. My bad. Exactly works how i described it, check the _boostrap.js

🇩🇪Germany marcoka

Thank you very much for this module. Really needed to use ckeditor productive in D10.

🇩🇪Germany marcoka

Thank you for the Info.
It can be reproduced with this page: https://ckeditor.com/docs/ckeditor5/latest/features/html/general-html-su...
Problem is that this "feature" kills content, data loss.
Can´t find any issues but the linked issue links an issue that is very similar.

🇩🇪Germany marcoka

@scotwith1t yes, i agree, of course that is an important function. Linking media is used everywhere :)

🇩🇪Germany marcoka

I use D10, 10.1
I will check on this later as i have so many problems with D10.

🇩🇪Germany marcoka

Checked console for errors. Found only this:

🇩🇪Germany marcoka

Downloaded the zip, installed. Where should the count appear? As far as i can see there are no settings, i read the code.

The idea here seems right. Use ck´s core feature and let the module just provide the settings.

🇩🇪Germany marcoka

#17 No the core patch does not fix this. Applied it to my drupal 10.1.
#14 Yes, your changes in the merge request will work, no more warnings in the drupal logs.

🇩🇪Germany marcoka

DId not work for me:
[webpack-cli] ReferenceError: sass_options is not defined

🇩🇪Germany marcoka

I am using
drupal 10.1
facets_pretty_paths 8.x-1.4
facets 2.0.6
and Facets Short Pretty Paths 1.0.0-alpha4

Everything seems to work fine here as far as i can see.

🇩🇪Germany marcoka

Thank you very much.

Feedback: That also works here with
drupal 10.1
facets 2.0.6
and Facets Short Pretty Paths 1.0.0-alpha4

🇩🇪Germany marcoka

I suggest manually compare files. As this is very old i close it. Reopen if still of interest.

🇩🇪Germany marcoka

This should be fixed with the latest beta16 and the use of a new SDK repository.
https://github.com/thewirecutter/paapi5-php-sdk
Please help testing.

Production build 0.69.0 2024