You are here

protected function UserRole::prepareValue in Feeds 8.3

Prepares a single value.

Parameters

int $delta: The field delta.

array $values: The values.

Overrides ConfigEntityReference::prepareValue

File

src/Feeds/Target/UserRole.php, line 90

Class

UserRole
Defines a user role mapper.

Namespace

Drupal\feeds\Feeds\Target

Code

protected function prepareValue($delta, array &$values) {
  try {
    return parent::prepareValue($delta, $values);
  } catch (ReferenceNotFoundException $e) {

    // Throw an exception with a more understandable message.
    throw new ReferenceNotFoundException($this
      ->t('The role %role cannot be assigned because it does not exist.', [
      '%role' => $values['target_id'],
    ]));
  }
}