You are here

public function MiconIcon::toJson in Micon 8

Same name and namespace in other branches
  1. 2.x src/MiconIcon.php \Drupal\micon\MiconIcon::toJson()

Returns a trimmed, json encoded string of the rendered markup.

Return value

string A json encoded string.

Overrides MiconIconInterface::toJson

File

src/MiconIcon.php, line 177

Class

MiconIcon
Defines the Micon icon.

Namespace

Drupal\micon

Code

public function toJson() {
  return json_encode(trim(preg_replace('/<!--(.|\\s)*?-->/', '', $this
    ->toMarkup()
    ->jsonSerialize())));
}