You are here

protected function InlineEntityFormBase::getCreateBundles in Inline Entity Form 8

Gets the bundles for which the current user has create access.

Return value

string[] The list of bundles.

2 calls to InlineEntityFormBase::getCreateBundles()
InlineEntityFormBase::canAddNew in src/Plugin/Field/FieldWidget/InlineEntityFormBase.php
Determines if the current user can add any new entities.
InlineEntityFormComplex::formElement in src/Plugin/Field/FieldWidget/InlineEntityFormComplex.php
Returns the form for a single field widget.

File

src/Plugin/Field/FieldWidget/InlineEntityFormBase.php, line 201

Class

InlineEntityFormBase
Inline entity form widget base class.

Namespace

Drupal\inline_entity_form\Plugin\Field\FieldWidget

Code

protected function getCreateBundles() {
  $create_bundles = [];
  foreach ($this
    ->getTargetBundles() as $bundle) {
    if ($this
      ->getAccessHandler()
      ->createAccess($bundle)) {
      $create_bundles[] = $bundle;
    }
  }
  return $create_bundles;
}