You are here

class ImageField in Realistic Dummy Content 8

Field modifier for image fields.

Hierarchy

  • class \Drupal\realistic_dummy_content_api\attributes\Attribute
    • class \Drupal\realistic_dummy_content_api\attributes\Field
      • class \Drupal\realistic_dummy_content_api\attributes\ImageField

Expanded class hierarchy of ImageField

1 file declares its use of ImageField
RealisticDummyContent.php in api/src/facade/RealisticDummyContent.php
Define autoload class.

File

api/src/attributes/ImageField.php, line 16
Define autoload class.

Namespace

Drupal\realistic_dummy_content_api\attributes
View source
class ImageField extends Field {

  /**
   * {@inheritdoc}
   */
  function GetExtensions() {
    return $this
      ->GetImageExtensions();
  }

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

}

Members

Namesort descending Modifiers Type Description Overrides
Attribute::$entity private property The entity is set on construction and is a subclass of EntityBase. It contains information about the entity to which this field instance is attached.
Attribute::$name private property The name of this attribuet, for example title, picture, field_image...
Attribute::Change function Changes this attribute by looking for data in files.
Attribute::ChangeFromFiles function Given candidate files, change the value of this attribute based on one of them.
Attribute::env function Returns the appropriate environment, real or testing.
Attribute::FileSave function Return a file object.
Attribute::GetBundle function Gets the bundle of the associated entity.
Attribute::GetCandidateFiles function Get all candidate files for a given field for this entity.
Attribute::GetEntity function Getter for $this->entity
Attribute::GetEntityType function Get the entity type of the associated entity.
Attribute::GetImageExtensions function Return acceptable image file extensions.
Attribute::GetName function Getter for $this->name
Attribute::GetTextExtensions function Return acceptable text file extensions.
Attribute::GetUid function Gets the UID of the associated entity.
Attribute::ImageSave function Return an image file object if possible.
Attribute::rand function Returns a pseudo-random number.
Attribute::ValueFromFile function Given a FileGroup object, get structured property if extentions ok.
Attribute::ValueFromFiles function Given a list of files, return a value from one of them.
Attribute::__construct function Constructor.
Field::GetType function Returns the type of this attribute. Overrides Attribute::GetType
ImageField::GetExtensions function Get acceptable file extensions which contain data for this attribute. Overrides Attribute::GetExtensions
ImageField::ValueFromFile_ function Given a FileGroup object, get a structured property Overrides Attribute::ValueFromFile_