class TextWithSummaryField in Realistic Dummy Content 8
Represents the text with summary field, which must have a text format when part of an entity object. Node body is one example.
Hierarchy
- class \Drupal\realistic_dummy_content_api\attributes\Attribute
- class \Drupal\realistic_dummy_content_api\attributes\Field
- class \Drupal\realistic_dummy_content_api\attributes\TextWithSummaryField
- class \Drupal\realistic_dummy_content_api\attributes\Field
Expanded class hierarchy of TextWithSummaryField
1 file declares its use of TextWithSummaryField
- RealisticDummyContent.php in api/
src/ facade/ RealisticDummyContent.php - Define autoload class.
File
- api/
src/ attributes/ TextWithSummaryField.php, line 17 - Define autoload class.
Namespace
Drupal\realistic_dummy_content_api\attributesView source
class TextWithSummaryField extends Field {
/**
* {@inheritdoc}
*/
function ValueFromFile_($file) {
$value = $file
->Value();
// @TODO use the site's default, not filtered_html, as the default format.
$format = $file
->Attribute('format', 'filtered_html');
// If the value cannot be determined, which is different from an empty string.
if ($value === NULL) {
$return = NULL;
}
elseif ($value) {
$return = array(
\Drupal\Core\Language\Language::LANGCODE_NOT_SPECIFIED => array(
array(
'value' => $value,
'format' => $format,
),
),
);
}
else {
$return = array();
}
return $return;
}
}
Members
Name | Modifiers | Type | Description | Overrides |
---|---|---|---|---|
Attribute:: |
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:: |
private | property | The name of this attribuet, for example title, picture, field_image... | |
Attribute:: |
function | Changes this attribute by looking for data in files. | ||
Attribute:: |
function | Given candidate files, change the value of this attribute based on one of them. | ||
Attribute:: |
function | Returns the appropriate environment, real or testing. | ||
Attribute:: |
function | Return a file object. | ||
Attribute:: |
function | Gets the bundle of the associated entity. | ||
Attribute:: |
function | Get all candidate files for a given field for this entity. | ||
Attribute:: |
function | Getter for $this->entity | ||
Attribute:: |
function | Get the entity type of the associated entity. | ||
Attribute:: |
function | Get acceptable file extensions which contain data for this attribute. | 2 | |
Attribute:: |
function | Return acceptable image file extensions. | ||
Attribute:: |
function | Getter for $this->name | ||
Attribute:: |
function | Return acceptable text file extensions. | ||
Attribute:: |
function | Gets the UID of the associated entity. | ||
Attribute:: |
function | Return an image file object if possible. | ||
Attribute:: |
function | Returns a pseudo-random number. | ||
Attribute:: |
function | Given a FileGroup object, get structured property if extentions ok. | ||
Attribute:: |
function | Given a list of files, return a value from one of them. | ||
Attribute:: |
function | Constructor. | ||
Field:: |
function |
Returns the type of this attribute. Overrides Attribute:: |
||
TextWithSummaryField:: |
function |
Given a FileGroup object, get a structured property Overrides Attribute:: |