You are here

public function ViewsDelimitedList::getConjunctives in Views Delimited List 2.x

Gets the conjunctives.

Return value

bool[] The conjunctive setting for the rows.

File

src/ViewsDelimitedList.php, line 113

Class

ViewsDelimitedList
Logic for separator, delimiters, and conjunctives.

Namespace

Drupal\views_delimited_list

Code

public function getConjunctives() {
  $last_conjunctive = in_array($this->separator, [
    'both',
    'conjunctive',
  ], TRUE);
  $conjunctives = [];
  foreach ($this->rows as $row_index => $row) {
    $current_row_index = $row_index + 1;
    $is_second_last_item = $current_row_index == $this->count - 1;
    $has_conjunctive = FALSE;
    if ($is_second_last_item && $last_conjunctive) {
      $has_conjunctive = TRUE;
    }
    $conjunctives[$row_index] = $has_conjunctive;
  }
  return $conjunctives;
}