public function FieldRedirectionResultBuilder::buildResult in Field Redirection 8.2
Builds a redirection result for a given set of values.
Parameters
\Drupal\Core\Field\FieldItemListInterface $items: The field items.
\Symfony\Component\HttpFoundation\Request $request: The request.
\Drupal\Core\Session\AccountInterface $account: The account.
array $settings: The field settings.
Return value
\Drupal\field_redirection\FieldRedirectionResult The redirection result.
File
- src/
FieldRedirectionResultBuilder.php, line 195
Class
- FieldRedirectionResultBuilder
- Defines a service for evaluating the intended action for a field redirection.
Namespace
Drupal\field_redirectionCode
public function buildResult(FieldItemListInterface $items, Request $request, AccountInterface $account, array $settings = []) {
if ($this
->shouldDeny($items, $request, $account, $settings)) {
return FieldRedirectionResult::deny();
}
return FieldRedirectionResult::fromUrl($items
->first()
->getUrl());
}