You are here

protected function LinkToFileConstraint::needsExtension in File Link 8

Same name and namespace in other branches
  1. 2.0.x src/Plugin/Validation/Constraint/LinkToFileConstraint.php \Drupal\file_link\Plugin\Validation\Constraint\LinkToFileConstraint::needsExtension()

Check whereas given link field needs an extension.

Parameters

\Drupal\file_link\Plugin\Field\FieldType\FileLinkItem $link: Link item.

Return value

bool Whereas link item needs an extension.

1 call to LinkToFileConstraint::needsExtension()
LinkToFileConstraint::validate in src/Plugin/Validation/Constraint/LinkToFileConstraint.php
Checks if the passed value is valid.

File

src/Plugin/Validation/Constraint/LinkToFileConstraint.php, line 144

Class

LinkToFileConstraint
Validation constraint for file_link, checking that URI points to a file.

Namespace

Drupal\file_link\Plugin\Validation\Constraint

Code

protected function needsExtension(FileLinkItem $link) {
  return !$link
    ->getFieldDefinition()
    ->getSetting('no_extension');
}