You are here

public function CloudBlock::getAssetUrl in Gutenberg 8.2

Same name and namespace in other branches
  1. 8 modules/gutenberg_cloud/src/CloudBlock.php \Drupal\gutenberg_cloud\CloudBlock::getAssetUrl()

Get asset URL.

Parameters

string $name: Name of the asset.

string $base_url: Base Url.

Return value

string|null Url of the asset or NULL if the asset name was not allowed or the name value was empty.

File

modules/gutenberg_cloud/src/CloudBlock.php, line 61

Class

CloudBlock
Class CloudBlock.

Namespace

Drupal\gutenberg_cloud

Code

public function getAssetUrl($name = '', $base_url = '') {
  $allowed = [
    'screenshot',
    'js',
    'edit_css',
    'view_css',
  ];
  if (empty($name) || !in_array($name, $allowed)) {
    return NULL;
  }
  return $base_url . $this
    ->getPrefix() . $this
    ->get($name);
}