drupal views if some information is duplicated do not show it repeated in subsequent rows of view
- drupal views if some information is duplicated do not show
- drupal views if some information is same in multiple rows do not repeat it
- views alter mode drupal
Some possible prior art, from Views Parity Row module: https://git.drupalcode.org/project/views_parity_row/-/blob/8.x-1.x/src/Plugin/Derivative/ViewsParityRowEntityRow.php?ref_type=heads
Ended up doing this:
function nchfa_custom_entity_view_mode_alter(&$view_mode, $entity) {
if ($view_mode !== 'teaser' || !isset($entity) || $entity->getEntityTypeId() !== 'node' || $entity->bundle() !== 'partner_program') {
// This would not be our view, bail early.
return;
}
static $partner_id;
if (isset($partner_id) && $partner_id === $entity->field_partner_id->value) {
// This partner program teaser has already been displayed on this page,
// display this additional sequential partner program without an address.
$view_mode = 'teaser_without_address';
}
else {
$partner_id = $entity->field_partner_id->value;
}
}