public static function Helper::getPageJsonForRoute in Structured Data (JSON+LD Rich Snippets) 8
Get page JSON for route.
Parameters
string $route_name: Route name string.
string $url: Optional URL.
Return value
mixed JSON for route.
1 call to Helper::getPageJsonForRoute()
- Helper::getPageJson in src/
Core/ Helper.php - Get page JSON.
File
- src/
Core/ Helper.php, line 64
Class
- Helper
- Class Helper.
Namespace
Drupal\structured_data\CoreCode
public static function getPageJsonForRoute($route_name, $url = NULL) {
$query = \Drupal::database()
->select('structured_data_json', 'sdj')
->fields('sdj')
->condition('route_name', $route_name);
if (empty($url)) {
$query
->addExpression("TRIM(IFNULL(url, '')) = ''");
}
else {
$query
->condition('url', $url);
}
$result = $query
->execute()
->fetchObject();
return $result;
}