This forum is for module development and code related questions, not general module support. For general support, use the Post installation forum.

How to suggest template for nodes with added external data

I have nodes with puzzles. I store extra info on the puzzle (say puzzle_sol) in a different table. I add this extra info to node in 'hook_node_storage_load' in my module. I then attach a special library to the page in page_attachments hook. There I use the above extra info to decide whether to attach the library or not. (if puzzle_sol was added, then attach the library ... else not)

This whole strategy is working without absolutely any issue.

Now the problem.

Get local oembed thumbnail path [solved + example]

I am currently trying to patch a module so that you can use the local oembed thumbnail to display as a preview.

Currently the direct url to the youtube thumbnail is used but that is, of course, not allowed by DSGVO/GDPR cancer.

My idea was to use the hook and load the thumbnail there. But OEmbed::getLocalThumbnailUri is a protected function.

Any ideas hints or tips? Any contrib doing this where i could read some code? Thank you.

function hook_preprocess_media_oembed_iframe(array &$variables) {

Is there a Media acces control mechanism in Drupal?

I am using hook_node_access_records() , and hook_node_grants() in a custom module for node acces control and it Works perfectly

I am wondering if there would be something similar for media entities??

Thanks in advance for your advices.

 

Struggling with dependency injection

I am still struggling to understand how to use dependecy injection correctly.

(This is all from the contributed extension Notify)

It has a a service class named "Notify".

In it, I am doing a lot of direct calls to global service containers. Example:

$nodes = \Drupal::entityTypeManager()->getStorage('node')->loadMultiple();

This works (i.e. it gets the nodes), but I am getting warned by PHPstan:

How does a path become content in Drupal 7? (aka auditing content effectively)

Heya! I'm working on a project for a client who is using Drupal 7. Among other things, we want to perform an audit of the content currently stored in their Drupal instance. Specifically, I want to create a list of every page / link on the site and any related files / downloads that Drupal is managing for them. 

Looking at the APIs, I honestly have no idea where to start here. I am also digging around the database and, while I see the nodes and various field_ tables that seem to have the content stored in them, I see no obvious way they're connected. 

Pages

Subscribe with RSS Subscribe to RSS - Module development and code questions