Skip to content

Commit

Permalink
Fix hard coded set url method while config is null (artesaos#148)
Browse files Browse the repository at this point in the history
  • Loading branch information
Duong Truong authored and vinicius73 committed Aug 12, 2019
1 parent ec393d3 commit 8fa3a73
Showing 1 changed file with 14 additions and 2 deletions.
16 changes: 14 additions & 2 deletions src/SEOTools/OpenGraph.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,13 @@ class OpenGraph implements OpenGraphContract
*/
protected $config;

/**
* Url property
*
* @var string
*/
protected $url = '';

/**
* Array of Properties.
*
Expand Down Expand Up @@ -275,7 +282,10 @@ protected function setupDefaults()
$this->images = $value;
}
} elseif ($key == 'url' && $value === null) {
$this->setUrl(app('url')->current());
$this->addProperty('url', $this->url ?: (($value === null)
? app('url')->current()
: $this->config['defaults.url'])
);
} elseif (! empty($value) && ! array_key_exists($key, $this->properties)) {
$this->addProperty($key, $value);
}
Expand Down Expand Up @@ -843,7 +853,9 @@ public function setDescription($description = null)
*/
public function setUrl($url)
{
return $this->addProperty('url', $url);
$this->url = $url;

return $this;
}

/**
Expand Down

0 comments on commit 8fa3a73

Please sign in to comment.