public function Instances::buildRow in Smart Date 3.4.x
Same name and namespace in other branches
- 8.2 modules/smart_date_recur/src/Controller/Instances.php \Drupal\smart_date_recur\Controller\Instances::buildRow()
- 3.x modules/smart_date_recur/src/Controller/Instances.php \Drupal\smart_date_recur\Controller\Instances::buildRow()
- 3.0.x modules/smart_date_recur/src/Controller/Instances.php \Drupal\smart_date_recur\Controller\Instances::buildRow()
- 3.1.x modules/smart_date_recur/src/Controller/Instances.php \Drupal\smart_date_recur\Controller\Instances::buildRow()
- 3.2.x modules/smart_date_recur/src/Controller/Instances.php \Drupal\smart_date_recur\Controller\Instances::buildRow()
- 3.3.x modules/smart_date_recur/src/Controller/Instances.php \Drupal\smart_date_recur\Controller\Instances::buildRow()
Builds a row for an instance in the listing.
Parameters
array $instance: The data for this row of the list.
Return value
array A render array structure of fields for this entity.
See also
\Drupal\Core\Entity\EntityListBuilder::render()
1 call to Instances::buildRow()
- Instances::render in modules/
smart_date_recur/ src/ Controller/ Instances.php - Builds the render array for the listings.
File
- modules/
smart_date_recur/ src/ Controller/ Instances.php, line 197
Class
- Instances
- Provides listings of instances (with overrides) for a specified rule.
Namespace
Drupal\smart_date_recur\ControllerCode
public function buildRow(array $instance) {
// Get format settings.
// TODO: make the choice of format configurable?
$format = \Drupal::getContainer()
->get('entity_type.manager')
->getStorage('smart_date_format')
->load('compact');
$settings = $format
->getOptions();
// Format range for this instance.
$row['label']['data'] = SmartDateTrait::formatSmartDate($instance['value'], $instance['end_value'], $settings);
if (isset($instance['class'])) {
$row['label']['class'][] = 'smart-date-instance--' . $instance['class'];
}
$row['operations']['data'] = $this
->buildOperations($instance);
return $row;
}