protected function JsonFeedFields::getAbsoluteUrlForField in JSON Feed 8
If the field value exists, return it as an absolute URL.
Parameters
int $row_index: The index count of the row as expected by views_plugin_style::getField().
string $field_id: The ID assigned to the required field in the display.
Return value
null|string The absolute URL for the field's value.
2 calls to JsonFeedFields::getAbsoluteUrlForField()
- JsonFeedFields::getAuthor in src/Plugin/ views/ row/ JsonFeedFields.php 
- Retrieve and format author attribute values.
- JsonFeedFields::render in src/Plugin/ views/ row/ JsonFeedFields.php 
- Render a row object. This usually passes through to a theme template of some form, but not always.
File
- src/Plugin/ views/ row/ JsonFeedFields.php, line 261 
Class
- JsonFeedFields
- Plugin which displays fields for a JSON feed.
Namespace
Drupal\json_feed\Plugin\views\rowCode
protected function getAbsoluteUrlForField($row_index, $field_id) {
  if (isset($this->options[$field_id])) {
    $field_value = $this
      ->getField($row_index, $this->options[$field_id]);
    if (strpos($field_value, '/') !== 0) {
      $field_value = '/' . $field_value;
    }
    return Url::fromUserInput($field_value)
      ->setAbsolute()
      ->toString();
  }
  return NULL;
}