Categories
CMS Drupal Mastering Development

Hide Publish State Option on Node for specific role of user

For example I have allowed visitors to register/login for writing a blog post, so I just want to remove/hide publish option in specific Node (blog) for writers, they can set state of node as draft/in review only.

Categories
CMS Drupal Mastering Development

Hide Publish State Option on Node for specific role of user

For example I have allowed visitors to register/login for writing a blog post, so I just want to remove/hide publish option in specific Node (blog) for writers, they can set state of node as draft/in review only.

Categories
CMS Drupal Mastering Development

Hide Publish State Option on Node for specific role of user

For example I have allowed visitors to register/login for writing a blog post, so I just want to remove/hide publish option in specific Node (blog) for writers, they can set state of node as draft/in review only.

Categories
CMS Drupal Mastering Development

Are there migration plugins for D8 sources?

I found 2 references here for migrating D8 to D8, but both are very outdated. Certainly there will be a need to do D7 -> D9 or D8 -> D9 migrations for many, but there are also current use cases. One is migrating from a multisite to individual sites. Mine is the site restructuring its […]

Categories
CMS Drupal Mastering Development

Get Webform Category Name in Preprocess

I am trying to get the Category name (from the General form settings) for webforms in a preprocess function, ultimately to add as a class to the webform wrapper. MYMODULE.module: function MYMODULE_preprocess_webform(&$variables) { kint($variables); } Right now I don’t see a “category” value in the array structure. Looks like you can query webforms with a […]

Categories
CMS Drupal Mastering Development

How do I load a Media entity from a File entity?

I have a File entity loaded programmatically. I want to load a Media entity from it. Is there a way to achieve this?

Categories
CMS Drupal Mastering Development

How can I programmatically delete a custom menu?

I’m writing a hook_deploy_N that moves a bunch of menu items from a deprecated custom menu to some newer ones. So far, so good. After moving the items, I want to delete the old menu, but can’t figure out how. \Drupal\Core\Menu\MenuTreeStorage has a delete function that may be what I’m looking for, but the \Drupal\Core\Menu\MenuTreeStorage […]

Categories
CMS Drupal Mastering Development

Restrict maximum 1 item allowed in cart commerce

I didn’t find anything relevant for Drupal 8 and Commerce 2.x to solve my issue. I want to restrict the number of allowed items in cart to 1. I tried to implement a hook but without succces, the workflow could be either to replace current item from cart, either print an error message. I need […]

Categories
CMS Drupal Mastering Development

Can TableSort honor form rebuilds?

I have a Form route in a site I am working on that is doing an entityQuery and displaying tabular data with some form elements to provide filtering, but without paging. For various reasons I can’t use Views to do this; a lot of the table cells are complex calculations and don’t lend themselves to […]

Categories
CMS Drupal Mastering Development

Display related content by taxonomy and children and also hide specific child taxonomy

I want to be able to display related tagged content by taxonomy and Children. I have this working with has taxonomy id with depth. Now I want ability to also hide specific children tags. On a node page, 1st reference to taxonomy is for related tags(include) 2nd reference is to taxonomy not display these specific […]