| 1 |
<?php |
| 2 |
|
| 3 |
/* |
| 4 |
* This file is part of the WindPress package. |
| 5 |
* |
| 6 |
* (c) Joshua Gugun Siagian <suabahasa@gmail.com> |
| 7 |
* |
| 8 |
* For the full copyright and license information, please view the LICENSE |
| 9 |
* file that was distributed with this source code. |
| 10 |
*/ |
| 11 |
declare (strict_types=1); |
| 12 |
namespace WindPress\WindPress\Integration\Timber; |
| 13 |
|
| 14 |
use WindPress\WindPress\Integration\IntegrationInterface; |
| 15 |
use WindPress\WindPress\Utils\Config; |
| 16 |
/** |
| 17 |
* @author Joshua Gugun Siagian <suabahasa@gmail.com> |
| 18 |
*/ |
| 19 |
class Main implements IntegrationInterface |
| 20 |
{ |
| 21 |
public function __construct() |
| 22 |
{ |
| 23 |
\add_filter('f!windpress/core/cache:compile.providers', fn(array $providers): array => $this->register_provider($providers)); |
| 24 |
} |
| 25 |
public function get_name() : string |
| 26 |
{ |
| 27 |
return 'timber'; |
| 28 |
} |
| 29 |
public function is_enabled() : bool |
| 30 |
{ |
| 31 |
return (bool) \apply_filters('f!windpress/integration/timber:enabled', Config::get(\sprintf('integration.%s.enabled', $this->get_name()), \true)); |
| 32 |
} |
| 33 |
public function register_provider(array $providers) : array |
| 34 |
{ |
| 35 |
$providers[] = ['id' => $this->get_name(), 'name' => 'Timber', 'description' => 'Timber integration', 'callback' => \WindPress\WindPress\Integration\Timber\Compile::class]; |
| 36 |
return $providers; |
| 37 |
} |
| 38 |
} |
| 39 |
|