You are here

public function Flowchart::getGraphDefinition in Business Rules 2.x

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

Get the workflow graph definition.

Parameters

\Drupal\Core\Entity\EntityInterface $item: The item.

Return value

array|string The graph definition.

File

src/Util/Flowchart/Flowchart.php, line 454

Class

Flowchart
Class Flowchart.

Namespace

Drupal\business_rules\Util\Flowchart

Code

public function getGraphDefinition(EntityInterface $item) {

  // Variables does not have graph.
  if ($item instanceof Variable) {
    return '';
  }
  $this
    ->mountMatrix($item);
  $graph_definition = [];
  $graph_definition[] = '<mxGraphModel dx="1426" dy="847" grid="1" gridSize="10" guides="1" tooltips="1" connect="1" arrows="1" fold="1" page="1" pageScale="1" pageWidth="850" pageHeight="1100" background="#ffffff"><root><mxCell id="0"/><mxCell id="1" parent="0"/>';

  // Prepare the graph.
  $graph_definition = array_merge($graph_definition, $this
    ->processMatrix());
  $graph_definition[] = '</root></mxGraphModel>';
  return implode('', $graph_definition);
}