diff --git a/CHANGELOG.md b/CHANGELOG.md index c1b949b9..a6222f1d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,21 @@ All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). +## [1.3.3] - 2019-08-15 + +### Changed + +- Fix MenuLinkable types + +BREAKING! + +Previous `string` enforcements failed in some cases, it is safer to just remove them. New type definitions for `getDisplayValue` and `getValue`: + +``` +public static function getDisplayValue($value = null) +public static function getValue($value = null, array $parameters = null) +``` + ## [1.3.2] - 2019-08-15 ### Changed @@ -103,6 +118,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - Nesting and re-ordering of menu-items - Creation of custom link options (ie links to Laravel models) +[1.3.3]: https://github.com/optimistdigital/nova-menu-builder/compare/1.3.2...1.3.3 [1.3.2]: https://github.com/optimistdigital/nova-menu-builder/compare/1.3.1...1.3.2 [1.3.1]: https://github.com/optimistdigital/nova-menu-builder/compare/1.3.0...1.3.1 [1.3.0]: https://github.com/optimistdigital/nova-menu-builder/compare/1.2.1...1.3.0 diff --git a/README.md b/README.md index a7cc3d9e..a7fb57a7 100644 --- a/README.md +++ b/README.md @@ -123,7 +123,7 @@ public static function getOptions($locale): array { * @param string $value * @return string **/ -public static function getDisplayValue(string $value): string { +public static function getDisplayValue($value = null) { // Example usecase // return 'Page: ' . Page::find($value)->name; return $value; @@ -138,7 +138,7 @@ public static function getDisplayValue(string $value): string { * @param array $parameters The JSON parameters added to the item. * @return any **/ -public static function getValue(string $value, array $parameters = null) +public static function getValue($value = null, array $parameters = null) // Example usecase // return Page::find($value); return $value; diff --git a/src/Classes/MenuItemBase.php b/src/Classes/MenuItemBase.php index 19ce1d8e..018bc1de 100644 --- a/src/Classes/MenuItemBase.php +++ b/src/Classes/MenuItemBase.php @@ -35,7 +35,7 @@ abstract public static function getType(): string; * @param string $value * @return string **/ - public static function getDisplayValue(?string $value): string + public static function getDisplayValue($value = null) { return $value; } @@ -49,7 +49,7 @@ public static function getDisplayValue(?string $value): string * @param array $parameters The JSON parameters added to the item. * @return any **/ - public static function getValue(?string $value, array $parameters = null) + public static function getValue($value = null, array $parameters = null) { return $value; } diff --git a/src/Classes/MenuItemText.php b/src/Classes/MenuItemText.php index 9b457889..426c4058 100644 --- a/src/Classes/MenuItemText.php +++ b/src/Classes/MenuItemText.php @@ -19,12 +19,12 @@ public static function getType(): string return 'text'; } - public static function getDisplayValue(?string $value): string + public static function getDisplayValue($value = null) { return ''; } - public static function getValue(?string $value, array $parameters = null) + public static function getValue($value = null, array $parameters = null) { return null; }