You are here

public function GroupRelationBase::getEntityReferenceSettings in Group 2.0.x

Returns a list of entity reference field settings.

This allows you to provide some handler settings for the entity reference field pointing to the entity that is to become group content. You could even change the handler being used, all without having to alter the bundle field settings yourself through an alter hook.

Return value

array An associative array where the keys are valid entity reference field setting names and the values are the corresponding setting for each key. Often used keys are 'target_type', 'handler' and 'handler_settings'.

Overrides GroupRelationInterface::getEntityReferenceSettings

1 call to GroupRelationBase::getEntityReferenceSettings()
GroupMembership::getEntityReferenceSettings in src/Plugin/Group/Relation/GroupMembership.php
Returns a list of entity reference field settings.
1 method overrides GroupRelationBase::getEntityReferenceSettings()
GroupMembership::getEntityReferenceSettings in src/Plugin/Group/Relation/GroupMembership.php
Returns a list of entity reference field settings.

File

src/Plugin/Group/Relation/GroupRelationBase.php, line 234

Class

GroupRelationBase
Provides a base class for GroupContentEnabler plugins.

Namespace

Drupal\group\Plugin\Group\Relation

Code

public function getEntityReferenceSettings() {
  $settings['target_type'] = $this
    ->getEntityTypeId();
  if ($bundle = $this
    ->getEntityBundle()) {
    $settings['handler_settings']['target_bundles'] = [
      $bundle,
    ];
  }
  return $settings;
}