You are here

public function Matrix::leftCellIsEmpty in Business Rules 2.x

Same name and namespace in other branches
  1. 8 src/Util/Flowchart/Matrix.php \Drupal\business_rules\Util\Flowchart\Matrix::leftCellIsEmpty()

Check if the cell at left from the element is empty.

Parameters

\Drupal\business_rules\Util\Flowchart\Element $element: The element.

Return value

bool TRUE|FALSE.

File

src/Util/Flowchart/Matrix.php, line 521

Class

Matrix
The matrix to handle the Business Rule flowchart.

Namespace

Drupal\business_rules\Util\Flowchart

Code

public function leftCellIsEmpty(Element $element) {
  $cell = $this
    ->getCellByElementUuid($element
    ->getUuid());
  $index_x = $cell['index_x'];
  $index_y = $cell['index_y'];
  if ($index_x == 0) {
    return TRUE;
  }
  $left_cell = $this
    ->getCellByPosition($index_x - 1, $index_y);
  if (empty($left_cell['element'])) {
    $empty = TRUE;
  }
  else {
    $empty = FALSE;
  }
  return $empty;
}