You are here

private function Flowchart::getMetaData in Business Rules 8

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

Get the item meta data.

Parameters

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

Return value

array The meta data.

2 calls to Flowchart::getMetaData()
Flowchart::getItemGraph in src/Util/Flowchart/Flowchart.php
Get the item's graph.
Flowchart::getRootGraph in src/Util/Flowchart/Flowchart.php
Get the root graph.

File

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

Class

Flowchart
Class Flowchart.

Namespace

Drupal\business_rules\Util\Flowchart

Code

private function getMetaData(EntityInterface $item) {
  $meta_data = [];
  if ($item instanceof BusinessRule) {
    $meta_data['style'] = 'shape=ellipse;whiteSpace=wrap;fillColor=#FFFFFF;strokeColor=#000000;strokeWidth=2;shadow=0;gradientColor=none;fontColor=#000000;';
    $meta_data['link'] = Url::fromRoute('entity.business_rule.edit_form', [
      'business_rule' => $item
        ->id(),
    ])
      ->toString();
  }
  elseif ($item instanceof Condition) {
    $meta_data['style'] = 'shape=rhombus;html=1;whiteSpace=wrap;aspect=fixed;strokeWidth=2;fillColor=#3399FF;strokeColor=#000000;fontColor=#000000;';
    $meta_data['link'] = Url::fromRoute('entity.business_rules_condition.edit_form', [
      'business_rules_condition' => $item
        ->id(),
    ])
      ->toString();
  }
  elseif ($item instanceof Action) {
    $meta_data['style'] = 'rounded=1;whiteSpace=wrap;html=1;fillColor=#66CC00;gradientColor=none;strokeWidth=2;strokeColor=#000000;fontColor=#000000;';
    $meta_data['link'] = Url::fromRoute('entity.business_rules_action.edit_form', [
      'business_rules_action' => $item
        ->id(),
    ])
      ->toString();
  }
  return $meta_data;
}