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

Using drush to automate creating and saving block content

Running Drupal 10.5. Is it possible to use drush to automate creating block content, saving in the database, assign it to a region and have it displayed?

I have found information how to create new modules on line but being a newbie this seems to be different from creating content, store it in the database, assign it to a region block to have it displayed, all using drush.

Thanks in advance.

Store a page in cache for all the authenticated users with a specific role

For the moment, each authenticated user generate a specific page cache (node entity) when he navigate on the website. 

Is there a possibility to use the same cache page (news node) for all users with a specific role (eg editor) ?

Do I use the cache_api for this ?

Thanks for yours examples and replies.

How to add summary, avg, min to selected view display programmatically

I created a new types of content (import) to which it imports data from CSV files. 
This node contains the field (field_result) in which the value is stored.
I added views that displays all nodes in the form of a table.

I want to add programmatically three rows to the view: sum, average and min

Now the table looks like this:

| Node name | field_result
------------------------------
| node1         |  3
| node2         |  5
| node3         |  2
 

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) {

Pages

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