You are here

public function CdfExpectations::getFieldValue in Acquia Content Hub 8.2

Return field value.

Parameters

string $field_name: Field name.

string $langcode: Language code.

Return value

mixed|array Field value.

File

tests/src/Kernel/Stubs/CdfExpectations.php, line 56

Class

CdfExpectations
Expectations for cdf fixtures.

Namespace

Drupal\Tests\acquia_contenthub\Kernel\Stubs

Code

public function getFieldValue(string $field_name, string $langcode = NULL) {
  if (is_null($langcode) && isset($this->data[$field_name])) {
    return $this->data[$field_name];
  }
  if (isset($this->data[$field_name][$langcode])) {
    return $this->data[$field_name][$langcode];
  }
  return [];
}