Talking Drupal Newsletter #406
#406 Drupal 10 Development Cookbook
Today we are talking about The Drupal 10 Development Cookbook with Kevin Quillen & Matt Glaman.
Topics
What is the Drupal 10 Development Cookbook
Contrast with Selwyn Polit’s Drupal At Your Fingertips
Who is the book for
How much experience to start
What should a reader expect to get out of reading the book
Core or contrib
Why write the book
Book writing process
Co-writing
Why a physical book
Is there a digital copy
Does it get updated
How long did it take to write
How did you write it
How did you break Drupal down to 14 chapters
Most surprising thing you had to research
Are you or the publisher going to translate the book
Would you write another book
Where is the best place to get the book
Resources
Blog post about checkbox
Guests
Kevin Quillen - @kevinquillen
Matt Glaman- @nmdmatt
Hosts
Nic Laflin - www.nLighteneddevelopment.com @nicxvan
John Picozzi - www.epam.com @johnpicozzi
Sean T. Walsh - @seantwalsh
Module of the Week
Martin Anderson-Clutz - @mandclu
Drupal 10.1
The module of the week this week is “Drupal 10.1"
Upcoming Episodes
#407 Sean’s Show. Recording on July 11.
#408 What’s New At The DA with Tim Doyle. Recording July 18
#409 Data Lakes with Melissa Bent and April Sides. Recording July 25.
#410 Same Page Preview with Chris Weber. Recording August 1.
Submit your questions on the #TalkingDrupal channel on Drupal Slack or DM us on twitter @talkingdrupal.
Drupal Camps
Drupal Camp Asheville 2023 07/07 - 07/09. In person
Drupal Developer Days 2023 Vienna #DDD23 07/19 - 07/23. In person
Design4Drupal Boston 2023 07/20 - 07/21. In person
DrupalCamp Colorado 2023 08/04 - 08/05. In person
Open Source/Drupal Camp Chattanooga 2023 08/05. In person
DecoupledDays 2023 08/16 - 08/17. In person
Local Meetups
Drupal Melbourne meetup - July 2023 07/13. Online
Drupal Mentoring Taipei - Meet and Drink! 07/19. In person
SFDUG - Simplifying Responsive Images in Drupal: Discover an Easier Approach 07/20. Online
A11yTalks - Accessibility in Action: Indigenous Communities 07/26. Online
Drupal Meetup Bangalore - July 2023 07/29. In person
Brisbane meetup Aug’23 08/02. In person
Tampa Bay Drupal User Group 08/03. In person
Training
Atomic & Molecular Design with Drupal 07/11 - 07/20. Online
Code of Conduct Incident Response Workshop 08/23. Online
Design4Drupal: July 20-21
Design4Drupal is a conference devoted to design, UX, and front-end development for Drupal websites and the business and process challenges facing Drupal teams.
Learn more and register now.
Drops of Drupal
Dynamic Entity Query Based on Moderation State
by Martin Anderson-Clutz
As part of my ongoing work on the Event Platform modules for organizing DrupalCamps and similar events, I wanted to add to the recently introduced Scheduler interface by allowing a site builder to specify a list of workflow (content moderation) states that would be used to restrict which sessions (or other content types) to list. After, it wouldn’t make sense to ask an editor to have to pick through the rejected sessions as part of the scheduling interface.
In looking for solutions to filter on content moderation state, the existing solution I was able to find adds a tag to the query:
/** @var \Drupal\node\NodeStorage $storage */
$storage = \Drupal::entityTypeManager()->getStorage('node');
$query = $storage->getQuery()
->addTag('moderation_state')
->condition('type', $content_types, 'IN');
$result = $query->execute();
And then, in the module file, it implements a hook to alter the query using a hard-coded definition of what state(s) to check for:
/**
* Implements hook_query_TAG_alter().
*/
function event_platform_scheduler_query_moderation_state_alter(Drupal\Core\Database\Query\AlterableInterface $query) {
$query->addJoin('LEFT', 'content_moderation_state_field_data', 'md', 'md.content_entity_revision_id = base_table.vid');
$query->condition('md.moderation_state', 'archived', '<>');
}
My challenge was that I wanted the list of moderation states to be configurable, so a site builder could customize in which states content would be listed in the scheduler, particularly since they can also customize which content types are available, and they may not all use the same workflow, or content moderation at all.
It turns out, there’s a relatively simple fix — add the desired moderation states to the query’s metadata:
$query = $storage->getQuery()
->addTag('moderation_state')
->condition('type', $content_types, 'IN')
->addMetaData('states', $moderation_states);
Then, in the hook implementation, load these to be used in the condition:
function event_platform_scheduler_query_moderation_state_alter(AlterableInterface $query) {
$states = $query->getMetaData('states') ?? [];
if ($states) {
$query->addJoin('LEFT', 'content_moderation_state_field_data', 'md', 'md.content_entity_revision_id = base_table.vid');
$query->condition('md.moderation_state', $states, 'IN');
}
}
Minifigure of the Week
by Nic Laflin
71037-9
This week I would like to share 71037-9 Newspaper Kid! This is the 9th minifigure in Series 24 of collectible minifigures. Released in 2023 I love the details on the apron!
Contact Us
@talkingdrupal on Twitter
#talkingdrupal on Drupal Slack