0

I'm trying to get the enabled content type machine names for a given group.

I wrote the following code, but to get the machine name I should cut the strings to group_node:.

    /** @var \Drupal\group\Entity\GroupType $group */
    $group = GroupType::load($groupKey);
    $plugins = $group->getInstalledContentPlugins();
    foreach ($plugins->getConfiguration() as $key => $plugin) {
      // Cut key here.
    }

1 Answer 1

0

Okay, I don't know how I missed this.

/** @var \Drupal\group\Entity\GroupType $group */
$group = GroupType::load($groupKey);
$plugins = $group->getInstalledContentPlugins();
foreach ($plugins as $key => $plugin) {
  $bundle = $plugin->getEntityBundle();
}

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.