WebTechKitchen; Your Web Technology Kitchen, contact us to create, or maintain your websites and other digital properties.

code to grab a field value from a D8 group module member field

Submitted by barnettech on Fri, 01/29/2021 - 10:23

code to grab a field value from a group module member field

  $group =  \Drupal\group\Entity\Group::load(31);
  $group_memberships = \Drupal::service('group.membership_loader')->loadByGroup($group);
  // $results = $query->execute();
  foreach ($group_memberships as $member) {
    //$group_id[] = $member->groupContent->values["field_group_id"]["x-default"][0]["value"];
    $group_id[] = $member->getGroupContent()->get("field_group_id")->value;
  $options = array_filter($group_id);

This worked to grab the uid from the member

Add JavaScript and external JavaScript in Service Now

Submitted by barnettech on Wed, 12/09/2020 - 14:20

Adding a UI script allows for adding any sort of JavaScript, and it can be made global. In the left admin serach box, just type in "UI Script" and then go from there to add a new one, or search existing ones.

this worked for instance

var script = document.createElement('script'); 
script.src = "https://www.example.com/example.min.js"; 

/*var script2 = document.createElement('script'); 
script2.src = "https://www.example.com/xapis/Pretranslate/xxxx-xxxx-xxxx-xxxx.js"; 

Connect Bose headset to Windows 10, this actually worked

Submitted by barnettech on Sat, 12/05/2020 - 16:45


* On the QC35, push the button on the right earpiece all the way to the Bluetooth sign and hold it there for at least 10 seconds. Do this with the headset on your head, so you can hear the commands: “all paired devices cleared” and “ready to pair.” (These may not be the exact phrases you hear, but close.)

Unable to install the XYZ module since it requires the A module

Submitted by barnettech on Thu, 11/19/2020 - 12:09

Unable to install the XYZ module since it requires the A module


"Adding the yaml_editor to core.extension.yml solved the issue. It perhaps were removed due to a complex git merge, and that's why my install process started to fail all that sudden."

Checking Drupal core and module version and status

Submitted by barnettech on Tue, 10/20/2020 - 10:05

composer outdated "drupal/*"

php -d memory_limit=-1 /usr/local/bin/composer update drupal/core-recommended --with-dependencies

If you wanted to update Drupal’s token module for example, you would use the command composer update drupal/token --with-dependencies


composer update would upgrade all modules