Skip to content
Snippets Groups Projects

Check for RevisionableEntityBundleInterface in og_ui_form_alter

1 file
+ 9
2
Compare changes
  • Side-by-side
  • Inline
+ 9
2
@@ -10,6 +10,7 @@ declare(strict_types=1);
use Drupal\Core\Config\Entity\ConfigEntityBundleBase;
use Drupal\Core\Entity\BundleEntityFormBase;
use Drupal\Core\Entity\EntityInterface;
use Drupal\Core\Entity\RevisionableEntityBundleInterface;
use Drupal\Core\Form\FormStateInterface;
use Drupal\field\Entity\FieldConfig;
use Drupal\field\Entity\FieldStorageConfig;
@@ -24,9 +25,15 @@ function og_ui_form_alter(array &$form, FormStateInterface $form_state, $form_id
return;
}
$entity_type = $form_state->getFormObject()->getEntity();
$entity = $form_state->getFormObject()->getEntity();
// Avoid entities like webform and commerce_product.
if (!$entity instanceof RevisionableEntityBundleInterface) {
return;
}
// To avoid insanity, a group membership cannot be a group or group content.
if ($entity_type->getEntityTypeId() === 'og_membership_type') {
if ($entity->getEntityTypeId() === 'og_membership_type') {
return;
}
Loading