You are here

public function FeedsItemFormatterBase::valueIsUrl in Feeds 8.3

Checks if a value is an url.

Parameters

string $value: The value to check.

Return value

bool TRUE if the value is an url. False otherwise.

1 call to FeedsItemFormatterBase::valueIsUrl()
FeedsItemGuidFormatter::viewElements in src/Plugin/Field/FieldFormatter/FeedsItemGuidFormatter.php
Builds a renderable array for a field value.

File

src/Plugin/Field/FieldFormatter/FeedsItemFormatterBase.php, line 22

Class

FeedsItemFormatterBase
Base class for the feeds item field formatters.

Namespace

Drupal\feeds\Plugin\Field\FieldFormatter

Code

public function valueIsUrl($value) {
  $scheme = parse_url($value, PHP_URL_SCHEME);
  if ($scheme === 'http' || $scheme === 'https') {
    return TRUE;
  }
  return FALSE;
}