mirror of
https://github.com/getgrav/grav.git
synced 2026-03-02 18:41:34 +01:00
Added Flex::getObject() for getting flex object directly
This commit is contained in:
@@ -11,6 +11,8 @@ declare(strict_types=1);
|
||||
|
||||
namespace Grav\Framework\Flex;
|
||||
|
||||
use Grav\Framework\Flex\Interfaces\FlexObjectInterface;
|
||||
|
||||
/**
|
||||
* Class Flex
|
||||
* @package Grav\Framework\Flex
|
||||
@@ -74,6 +76,13 @@ class Flex implements \Countable
|
||||
return $this->types[$type] ?? null;
|
||||
}
|
||||
|
||||
public function getObject(string $type, string $key): ?FlexObjectInterface
|
||||
{
|
||||
$directory = $type ? $this->getDirectory($type) : null;
|
||||
|
||||
return $directory ? $directory->getObject($key) : null;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return int
|
||||
*/
|
||||
|
||||
Reference in New Issue
Block a user