mirror of
https://github.com/getgrav/grav.git
synced 2026-07-07 16:22:59 +02:00
Merge branch 'feature-multimedia' into develop
* feature-multimedia: reset on construct thumbnail selection fixes remove debugger line
This commit is contained in:
@@ -171,7 +171,6 @@ trait ParsedownGravTrait
|
||||
if (isset($url['fragment'])) {
|
||||
$medium->urlHash($url['fragment']);
|
||||
}
|
||||
self::$grav['debugger']->addMessage($url);
|
||||
|
||||
$excerpt['element'] = $medium->parseDownElement($title, $alt, $class);
|
||||
|
||||
|
||||
@@ -58,6 +58,7 @@ class Medium extends Data implements RenderableInterface
|
||||
parent::__construct($items, $blueprint);
|
||||
|
||||
$this->def('mime', 'application/octet-stream');
|
||||
$this->reset();
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -265,7 +266,7 @@ class Medium extends Data implements RenderableInterface
|
||||
*/
|
||||
public function thumbnail($type = 'auto')
|
||||
{
|
||||
if (!in_array($type, $this->thumbnailTypes))
|
||||
if ($type !== 'auto' && !in_array($type, $this->thumbnailTypes))
|
||||
return $this;
|
||||
|
||||
if ($this->thumbnailType !== $type) {
|
||||
|
||||
@@ -64,6 +64,19 @@ class ThumbnailImageMedium extends ImageMedium
|
||||
return $this->bubble('display', [$mode], false);
|
||||
}
|
||||
|
||||
/**
|
||||
* Switch thumbnail.
|
||||
*
|
||||
* @param string $type
|
||||
*
|
||||
* @return $this
|
||||
*/
|
||||
public function thumbnail($type = 'auto')
|
||||
{
|
||||
$this->bubble('thumbnail', [$type], false);
|
||||
return $this->bubble('getThumbnail', [], false);
|
||||
}
|
||||
|
||||
/**
|
||||
* Turn the current Medium into a Link
|
||||
*
|
||||
@@ -100,7 +113,7 @@ class ThumbnailImageMedium extends ImageMedium
|
||||
protected function bubble($method, array $arguments = [], $testLinked = true)
|
||||
{
|
||||
if (!$testLinked || $this->linked) {
|
||||
return call_user_func_array(array($this->parent, $method), $arguments);
|
||||
return $this->parent ? call_user_func_array(array($this->parent, $method), $arguments) : $this;
|
||||
} else {
|
||||
return call_user_func_array(array($this, 'parent::' . $method), $arguments);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user