You are here

ValueField.php in Realistic Dummy Content 8

Define autoload class.

File

api/src/attributes/ValueField.php
View source
<?php

/**
 * @file
 *
 * Define autoload class.
 */
namespace Drupal\realistic_dummy_content_api\attributes;

use Drupal\realistic_dummy_content_api\attributes\Field;

/**
 * Represents a generic field which appears in an entity object as
 * array('value' => 'xyz').
 */
class ValueField extends Field {

  /**
   * {@inheritdoc}
   */
  function ValueFromFile_($file) {
    $value = $file
      ->Value();
    if ($value === NULL) {
      return;
    }
    return array(
      \Drupal\Core\Language\Language::LANGCODE_NOT_SPECIFIED => array(
        array(
          'value' => $value,
        ),
      ),
    );
  }

}

Classes

Namesort descending Description
ValueField Represents a generic field which appears in an entity object as array('value' => 'xyz').