Defines the Tripal field formatter base class.
◆ addMaxDeltaWarning()
| Drupal\tripal\TripalField\TripalFormatterBase::addMaxDeltaWarning |
( |
array & |
$elements, |
|
|
array & |
$list, |
|
|
?array |
$markup = NULL |
|
) |
| |
Provides a visible warning message when max_delta has been exceeded.
- Parameters
-
| array | &$elements | The render array elements. |
| array | &$list | The viewElements to be formatted. The list size may exceed max_delta by one, this is the indicator to display the message, and this last element will be removed. |
| array | null | $markup | Custom render array markup to override the default message. |
- Returns
- void &$elements is modified when appropriate
◆ createListMarkup()
| Drupal\tripal\TripalField\TripalFormatterBase::createListMarkup |
( |
array |
$list | ) |
|
HELPER: Makes multiple renderable items into a list.
Note: If the number of items exceeds the max delta for this field, then a warning will be added right before the list.
- Parameters
-
| array | $list | A list of renderable items. |
- Returns
- array A render array where (1) if no items then an empty element is returned, (2) if there is one item it is passed through unchanged, (3) if
$items <= $max_delta then a list of items is returned, (4) if $items > $max_delta then two elements are returned where the first is a warning string and the second is a list of items.
◆ sanitizeKey()
| Drupal\tripal\TripalField\TripalFormatterBase::sanitizeKey |
( |
|
$key | ) |
|
Sanitizes a property key.
Property keys are often controlled vocabulary IDs, which is the IdSpace and accession separated by a colon. The colon is not supported by the storage backend and must be converted to an underscore. This function performs that task.
- Parameters
-
| string | $key | A property key e.g. "operation:2945". |
- Returns
- string A sanitizied string.
The documentation for this class was generated from the following file:
- tripal/src/TripalField/TripalFormatterBase.php