You are here

public function LayoutCanvasAwareTrait::isLayoutCanvas in TMGMT Translator Smartling 8.4

Parameters

$json:

Return value

bool|LayoutCanvas

2 calls to LayoutCanvasAwareTrait::isLayoutCanvas()
AcquiaCohesionDataConverter::findAndConvertCohesionJsonDataToCohesionXmlData in modules/tmgmt_smartling_acquia_cohesion/src/AcquiaCohesionDataConverter.php
Converts Cohesion's JSON components to TMGMT Smartling's XML data items.
AcquiaCohesionDataSuggester::walkRecursiveAndGetSuggestions in modules/tmgmt_smartling_acquia_cohesion/src/AcquiaCohesionDataSuggester.php
Only implemented manually because phpunit fails to run tests with closures.

File

modules/tmgmt_smartling_acquia_cohesion/src/LayoutCanvasAwareTrait.php, line 12

Class

LayoutCanvasAwareTrait

Namespace

Drupal\tmgmt_smartling_acquia_cohesion

Code

public function isLayoutCanvas($json) {
  if (preg_match('/^\\{"canvas":\\[(.*)\\}$/', $json) !== 1 || empty(json_decode((string) $json))) {
    return false;
  }
  return new LayoutCanvas($json);
}