The "gdpr_task" entity type does not exist. Drupal 9

On my local the error comes up when enabling the Layout builder module.

I believe it was because the previous developer had GDPR installed and enable then decided not to use the module and disabled it.

 

So I re-enabled the module and the error went away.

 

To get rid of GDPR_tasks

1.lando drush en gdpr_tasks -y

2. drush config-delete field.field.gdpr_task.gdpr_remove.removal_log
3. drush config-delete field.storage.gdpr_task.removal_log
4. drush pmu gdpr_tasks

5. lando drush pmu gdpr -y

Email one time Password Reset link to a user from Admin side- Drupal 9

This changed a little bit from Drupal 7 so here's the code.

The module adds a button to the bottom of the User "Edit" page. :) Click the button and it shoots an email with a reset link to that user. :) 

 

YourModuleName.info.yml File

name: 'YourModuleName'
type: module
description: 'Reset Password link for administrators'
core_version_requirement: ^8 || ^9
package: 'Custom'

 

YourModuleName.moduleFile

<?php

 

/**

Lando, Composer, Drush, Drupal Core Update

Just started using PlatformSh so these are just instructions for me. In case I forget how to do it.

 

1. Lando Start

2.  lando composer install
(Make sure it is there and updated)

3. lando composer update "drupal/core-*" --with-all-dependencies
(Gets the newest drupal core with composer)

4. lando drush updb -y
(Updates the database)

5. lando rebuild
(Makes it clean. :) )

 

If you run into a Composer memory allot issue, do this:

Run these commands

Drupal 9 Dropdown list Profile fields. "Select One" as default value on required field - forces user to complete

For select list/ drop down lists.  You may have run into the problem that you need it required and it has a default value that may be overlooked causing a break in data integrity.  

in your dropdown allowed values do this

|Select One
Value1|Value 1
Value2| Value 2

 

Set your default to the "Select One" which is technically a "Null" value since there isn't a key before the pipe "|".  This causes the validation message to fire. :)

 

Tower, Git, Lando, Platform SH starting over from scratch after you get lost in your changes

I need to start over from scratch and pull down the original code from the repository because I was just lost in my changes.

In my local directory, I erased the repository.

In tower I went and pulled my repository branch down again.

Right clicked and "Open in terminal"

then commands:

1. lando start

2. Lando pull

a. added database with spacebar and then enter

b. pulled down "default" folder with spacebar and enter

3. lando rebuild

 

User Fields for API Post Man Body

Method : POST

Url : http://192.168.43.172/c19012022/user/register?_format=hal_json

Headers : Content-Type value: application/hal+json

Body :

Drupal 9 Profile Address Country Field selected not saving/ sticking on multistep form when using previous/ back button

If you are using the Profile entity Address field in a multi-step form and allow the user to go back to edit a previous step of the form and the page does not retain the information that was previously entered...

This fix is for you!

Check the configuration of your Profile Address Field.

If you choose to have a "Default" Country but use any of the fields of the Address field collection, all pieces of the Address Field NEED a default selected in the GUI too. 

For instance:

Custom User Field selected value as default for Drupal

With help from the awesome Ryan!

 'profession' => [
          '#type' => 'select',
          '#title' => $this->t('Professional Category'),
          '#required' => TRUE,
          '#empty_option' => $this->t('- Select -'),
          '#options' => $professions,
          '#default_value' => isset($user) ? $user->get('field_profession')->target_id : '',
        ],

 

Profession is the custom user field.

:)

 

Sublime as default editor and Diff tool for MAC Git - Git Commands

 

Diff Tool

You can use you Console or edit the config file directly. Either will work.

IN GIT

Run this:

git config --global diff.tool subl                   
("l" is and lowercase L)

Then run this:

git config --global difftool.subl.cmd "subl --wait --diff $LOCAL $REMOTE"

OR

Pages

Subscribe to Melinda Cozza - Power Platform and CMS Developer RSS