You are here

protected function MessageType::getValue in Message 7

Helper function to get the value from a property.

If the property is of type 'text_formatted' get the processed text value.

Parameters

$property: The wrapped property object.

$delta: The delta of the field.

$options: Array of options that might be needed to get the field value.

Return value

The wrapped property that can be used to get the text value of the field (i.e. safe-value or plain text).

1 call to MessageType::getValue()
MessageType::getText in includes/message.message_type.inc
Retrieves the configured message text in a certain language.

File

includes/message.message_type.inc, line 227
A class used for message types.

Class

MessageType
@file A class used for message types.

Code

protected function getValue($property, $delta, $options) {
  if ($property instanceof EntityStructureWrapper && isset($property->value) && $property
    ->value($options)) {

    // Single value field.
    $property = $property->value;
  }
  elseif ($property instanceof EntityListWrapper && $property
    ->get($delta)
    ->value($options) && $property
    ->get($delta) instanceof EntityStructureWrapper && isset($property
    ->get($delta)->value)) {

    // Multiple value field.
    $property = $property
      ->get($delta)->value;
  }
  return $property;
}