Added Flex::getObject() for getting flex object directly

This commit is contained in:
Matias Griese
2018-12-19 17:40:09 +02:00
parent 5a6e6dceda
commit 6c6e8d2605

View File

@@ -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
*/