public function Matrix::getElementByItem in Business Rules 2.x
Same name and namespace in other branches
- 8 src/Util/Flowchart/Matrix.php \Drupal\business_rules\Util\Flowchart\Matrix::getElementByItem()
Get matrix element by item.
Parameters
\Drupal\Core\Entity\EntityInterface $item: The item.
Return value
\Drupal\business_rules\Util\Flowchart\Element The Element.
File
- src/
Util/ Flowchart/ Matrix.php, line 135
Class
- Matrix
- The matrix to handle the Business Rule flowchart.
Namespace
Drupal\business_rules\Util\FlowchartCode
public function getElementByItem(EntityInterface $item) {
for ($y = 0; $y <= 100; $y++) {
for ($x = 0; $x <= 100; $x++) {
if (is_object($this->matrix[$x][$y]['element'])) {
if ($this->matrix[$x][$y]['element']
->getItem() === $item) {
return $this->matrix[$x][$y]['element'];
}
}
}
}
}