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

List all user fields

I tried to get a list of all user fields (machine names and labels), both the defaults such as username, but also the user fields added in the admin panel. I did find something, but I don't think its the right way.

This will only give the default of the user:

\Drupal::service('entity_field.manager')->getFieldDefinitions('user', 'fields')

The other method I tried was:

How to count the number of class on my page and display it in a menu counter ?

I have a site that I created with Drupal 8.

I have a page with a list of tasks like below :

https://i.stack.imgur.com/I49TU.png

- The tasks of color "Red" have the class task-list-danger

- The tasks of color "Orange" have the class task-list-warning

Modify body markup for display only

I am porting a D7 module that i want to release for D8. 

The module injects a block that you can select into the body. The problem i have is that i achived to manipulate the body field and save it, BUT it is really saved to the DB not only for the display. That is very bad as i only want the injection to be happen at display withoput changing the original body content.

Because of forUpdate facing issue with query on slave

 protected function buildQuery($ids, $conditions = array(), $revision_id = FALSE) {

    $query = parent::buildQuery($ids, $conditions, $revision_id);

    if ($this->pessimisticLocking && isset($this->entityInfo['locking mode']) && $this->entityInfo['locking mode'] == 'pessimistic') {

      // In pessimistic locking mode, we issue the load query with a FOR UPDATE

      // clause. This will block all other load queries to the loaded objects

      // but requires us to start a transaction.

Converting/Upgrading a Drupal 8 module to 9 (not using Drush)

Hey there, 

I did a quick search and couldn't find much about upgrading/updating modules to Drupal 9. I'm sorry if I missed it, please just point me to right direction. 

Long time Drupal user (5.x was my first experiment with Drupal and I've been on Drupal since the early days of 6 - not using Drush - yet ).

I need some guidance about Drupal 8.x modules/themes upgrading to Drupal 9.

I'm ready to move on to Drupal 9 (currently 8.9) but my theme and slider are not compatible (or at least, have not been updated for 9). Suggestions?

Accessing an object's :protected value

I am trying to retrieve an object's protected key/value

Pages

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