mirror of
https://github.com/getgrav/grav.git
synced 2026-04-14 16:47:35 +02:00
Added support for flex-required@: not exists and flex-required@: '!exists' in blueprints
This commit is contained in:
@@ -5,6 +5,7 @@
|
||||
* Added `|yaml` filter to convert input to YAML
|
||||
* Added `route` and `request` to `onPageNotFound` event
|
||||
* Added file upload/remove support for `Flex Forms`
|
||||
* Added support for `flex-required@: not exists` and `flex-required@: '!exists'` in blueprints
|
||||
* Throwing exceptions from Twig templates fires `onDisplayErrorPage.[code]` event allowing better error pages
|
||||
3. [](#bugfix)
|
||||
* Fixed escaping in PageIndex::getLevelListing()
|
||||
|
||||
@@ -41,6 +41,14 @@ class UserGroupObject extends FlexObject implements UserGroupInterface
|
||||
] + parent::getCachedMethods();
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
public function getTitle(): string
|
||||
{
|
||||
return $this->getProperty('readableName');
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks user authorization to the action.
|
||||
*
|
||||
|
||||
@@ -306,6 +306,14 @@ class UserObject extends FlexObject implements UserInterface, Countable
|
||||
return $value;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return UserGroupIndex
|
||||
*/
|
||||
public function getRoles(): UserGroupIndex
|
||||
{
|
||||
return $this->getGroups();
|
||||
}
|
||||
|
||||
/**
|
||||
* Convert object into an array.
|
||||
*
|
||||
|
||||
@@ -836,13 +836,22 @@ class FlexDirectory implements FlexDirectoryInterface
|
||||
$params = (array)$call['params'];
|
||||
$object = $call['object'] ?? null;
|
||||
$method = array_shift($params);
|
||||
$not = false;
|
||||
if (str_starts_with($method, '!')) {
|
||||
$method = substr($method, 1);
|
||||
$not = true;
|
||||
} elseif (str_starts_with($method, 'not ')) {
|
||||
$method = substr($method, 4);
|
||||
$not = true;
|
||||
}
|
||||
$method = trim($method);
|
||||
|
||||
if ($object && method_exists($object, $method)) {
|
||||
$value = $object->{$method}(...$params);
|
||||
if (is_array($value) && isset($field[$property]) && is_array($field[$property])) {
|
||||
$value = $this->mergeArrays($field[$property], $value);
|
||||
}
|
||||
$field[$property] = $value;
|
||||
$field[$property] = $not ? !$value : $value;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user