You are here

public static function DefaultUserReferenceHandler::supports in CMS Content Sync 2.1.x

Same name and namespace in other branches
  1. 8 src/Plugin/cms_content_sync/field_handler/DefaultUserReferenceHandler.php \Drupal\cms_content_sync\Plugin\cms_content_sync\field_handler\DefaultUserReferenceHandler::supports()
  2. 2.0.x src/Plugin/cms_content_sync/field_handler/DefaultUserReferenceHandler.php \Drupal\cms_content_sync\Plugin\cms_content_sync\field_handler\DefaultUserReferenceHandler::supports()

Check if this handler supports the given field instance.

Parameters

string $entity_type:

string $bundle:

string $field_name:

Return value

bool

Overrides DefaultEntityReferenceHandler::supports

File

src/Plugin/cms_content_sync/field_handler/DefaultUserReferenceHandler.php, line 30

Class

DefaultUserReferenceHandler
Providing a minimalistic implementation for any field type.

Namespace

Drupal\cms_content_sync\Plugin\cms_content_sync\field_handler

Code

public static function supports($entity_type, $bundle, $field_name, FieldDefinitionInterface $field) {
  if (!in_array($field
    ->getType(), [
    'entity_reference',
    'entity_reference_revisions',
  ])) {
    return false;
  }
  $type = $field
    ->getSetting('target_type');
  return 'user' == $type;
}