mirror of
https://github.com/getgrav/grav.git
synced 2025-12-05 23:39:58 +01:00
manually merged new attribute() method #3065
This commit is contained in:
@@ -1,6 +1,8 @@
|
||||
# v1.7.6
|
||||
## mm/dd/2021
|
||||
|
||||
1. [](#new)
|
||||
* Added `Medium::attribute()` to pass arbitrary attributes [#3065](https://github.com/getgrav/grav/pull/3065)
|
||||
1. [](#improved)
|
||||
* Added abstract `FlexObject`, `FlexCollection` and `FlexIndex` classes to `\Grav\Common\Flex` namespace (extend those instead of Framework or Generic classes)
|
||||
* Updated bundled `composer.phar` binary to latest version `2.0.9`
|
||||
|
||||
@@ -115,6 +115,15 @@ interface MediaObjectInterface extends \Grav\Framework\Media\Interfaces\MediaObj
|
||||
*/
|
||||
public function reset();
|
||||
|
||||
/**
|
||||
* Add custom attribute to medium.
|
||||
*
|
||||
* @param string $attribute
|
||||
* @param string $value
|
||||
* @return $this
|
||||
*/
|
||||
public function attribute($attribute = null, $value = '');
|
||||
|
||||
/**
|
||||
* Switch display mode.
|
||||
*
|
||||
|
||||
@@ -303,6 +303,21 @@ trait MediaObjectTrait
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Add custom attribute to medium.
|
||||
*
|
||||
* @param string $attribute
|
||||
* @param string $value
|
||||
* @return $this
|
||||
*/
|
||||
public function attribute($attribute = null, $value = '')
|
||||
{
|
||||
if (!empty($attribute)) {
|
||||
$this->attributes[$attribute] = $value;
|
||||
}
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Switch display mode.
|
||||
*
|
||||
|
||||
Reference in New Issue
Block a user