You are here

public static function Tumblr::validateValue in Social Media Links Block and Field 8.2

Validates the user input of a platform before the value is saved.

Return value

mixed The result of the validation.

Overrides PlatformBase::validateValue

File

src/Plugin/SocialMediaLinks/Platform/Tumblr.php, line 23

Class

Tumblr
Provides 'tumblr' platform.

Namespace

Drupal\social_media_links\Plugin\SocialMediaLinks\Platform

Code

public static function validateValue(array &$element, FormStateInterface $form_state, array $form) {
  if (!empty($element['#value'])) {
    if (!UrlHelper::isValid($element['#value'], TRUE)) {
      $form_state
        ->setError($element, t('The entered Tumblr URI is not valid.'));
    }
  }
}