Example #1
0
 /**
  * Renders the metadata.
  *
  * @param array $attributes
  *
  * @return string
  */
 public function render(array $attributes = [])
 {
     $html = '';
     // Add some default options
     $attributes = array_merge(['card' => 'summary', 'site' => $this->project, 'url' => $this->url->current()], $this->metadata, $attributes);
     // Format URLs if provided
     $image = array_get($attributes, 'image');
     if (!file_exists($this->publicFolder . $image) || strpos($image, 'placeholder') !== false) {
         $image = $this->getPlaceholderIllustration();
     }
     $attributes['image'] = $this->url->asset($image);
     // Get Twitter equivalents
     $twitterProperties = ['name' => 'title', 'image' => 'image:src'];
     // Append attributes
     foreach ($attributes as $name => $value) {
         $twitter = array_get($twitterProperties, $name, $name);
         $html .= $this->getWrapper($twitter, $name, $value) . PHP_EOL;
     }
     return $html;
 }
Example #2
0
 /**
  * Create a HTML image input element.
  *
  * @param string $url
  * @param string $name
  * @param array  $attributes
  *
  * @return \Illuminate\Support\HtmlString
  */
 public function image($url, $name = null, $attributes = [])
 {
     $attributes['src'] = $this->url->asset($url);
     return $this->input('image', $name, null, $attributes);
 }
Example #3
0
 /**
  * Generate a HTML link to an asset.
  *
  * @param  string  $url
  * @param  string  $title
  * @param  array   $attributes
  * @param  bool    $secure
  *
  * @return string
  */
 public function linkAsset($url, $title = null, $attributes = [], $secure = null)
 {
     $url = $this->url->asset($url, $secure);
     return $this->link($url, $title ?: $url, $attributes, $secure);
 }
 /**
  * {@inheritdoc}
  */
 public function asset($path, $secure = null)
 {
     // Assets are not subject to permissions.
     return $this->url->asset($path, $secure);
 }
Example #5
0
 public function toAsset($path)
 {
     return $this->generator->asset($path);
 }
Example #6
0
 /**
  * Resolve a path from the `theme` directory
  *
  * @param $path
  *
  * @return string
  */
 public function resolveThemeAsset($path)
 {
     return $this->url->asset($this->resolvePath($path, $this->themeManifest, 'theme'));
 }