You are here

public function BUEditorButton::jsProperties in BUEditor 8

Same name and namespace in other branches
  1. 8.2 src/Entity/BUEditorButton.php \Drupal\bueditor\Entity\BUEditorButton::jsProperties()

Returns an array of button properties for JS.

File

src/Entity/BUEditorButton.php, line 116

Class

BUEditorButton
Defines the BUEditor Button entity.

Namespace

Drupal\bueditor\Entity

Code

public function jsProperties() {
  $props = [
    'id',
    'label',
    'tooltip',
    'text',
    'cname',
    'shortcut',
    'code',
    'template',
  ];
  $data = [];
  foreach ($props as $prop) {
    if ($value = $this
      ->get($prop)) {
      $data[$prop] = $value;
    }
  }
  return $data;
}