Skip to content

Commit

Permalink
Merge branch '8.x-dev' of https://github.com/Cecilapp/Cecil into 8.x-dev
Browse files Browse the repository at this point in the history
  • Loading branch information
ArnaudLigny committed Dec 6, 2023
2 parents 607d9d6 + c0ce4b7 commit e2f06bf
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 15 deletions.
9 changes: 5 additions & 4 deletions docs/3-Templates.md
Original file line number Diff line number Diff line change
Expand Up @@ -109,10 +109,11 @@ All rules are detailed below, for each page type, in the priority order.
2. `index.<format>.twig`
3. `home.<format>.twig`
4. `list.<format>.twig`
5. `_default/index.<format>.twig`
6. `_default/home.<format>.twig`
7. `_default/list.<format>.twig`
8. `_default/page.<format>.twig`
5. `_default/<layout>.<format>.twig`
6. `_default/index.<format>.twig`
7. `_default/home.<format>.twig`
8. `_default/list.<format>.twig`
9. `_default/page.<format>.twig`

### Type _page_

Expand Down
3 changes: 1 addition & 2 deletions src/Renderer/Language.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@

namespace Cecil\Renderer;

use Cecil\Config;
use Cecil\Exception\RuntimeException;

/**
Expand All @@ -27,7 +26,7 @@ class Language
/** @var string Current language. */
protected $language;

public function __construct(Config $config, string $language = null)
public function __construct(\Cecil\Config $config, string $language = null)
{
$this->config = $config;
$this->language = $language;
Expand Down
16 changes: 9 additions & 7 deletions src/Renderer/Layout.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@

use Cecil\Collection\Page\Page as CollectionPage;
use Cecil\Collection\Page\Type as PageType;
use Cecil\Config;
use Cecil\Exception\RuntimeException;
use Cecil\Util;

Expand All @@ -31,7 +30,7 @@ class Layout
*
* @throws RuntimeException
*/
public static function finder(CollectionPage $page, string $format, Config $config): array
public static function finder(CollectionPage $page, string $format, \Cecil\Config $config): array
{
$layout = 'unknown';

Expand Down Expand Up @@ -77,7 +76,7 @@ public static function finder(CollectionPage $page, string $format, Config $conf
*
* @see finder()
*/
protected static function fallback(CollectionPage $page, string $format, Config $config): array
protected static function fallback(CollectionPage $page, string $format, \Cecil\Config $config): array

Check warning on line 79 in src/Renderer/Layout.php

View check run for this annotation

Codacy Production / Codacy Static Code Analysis

src/Renderer/Layout.php#L79

The method fallback() has 100 lines of code. Current threshold is set to 100. Avoid really long methods.

Check warning on line 79 in src/Renderer/Layout.php

View check run for this annotation

Codacy Production / Codacy Static Code Analysis

src/Renderer/Layout.php#L79

The method fallback() has a Cyclomatic Complexity of 17. The configured cyclomatic complexity threshold is 10.
{
$ext = self::EXT;

Expand All @@ -91,14 +90,17 @@ protected static function fallback(CollectionPage $page, string $format, Config
"index.$format.$ext",
"home.$format.$ext",
"list.$format.$ext",
];
if ($page->hasVariable('layout')) {
$layouts = array_merge(["$layout.$format.$ext"], $layouts, ["_default/$layout.$format.$ext"]);
}
$layouts = array_merge($layouts, [
// "_default/$layout.$format.$ext",
"_default/index.$format.$ext",
"_default/home.$format.$ext",
"_default/list.$format.$ext",
"_default/page.$format.$ext",
];
if ($page->hasVariable('layout')) {
$layouts = array_merge(["$layout.$format.$ext"], $layouts);
}
]);
break;
case PageType::SECTION->value:
$layouts = [
Expand Down
3 changes: 1 addition & 2 deletions src/Renderer/Page.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@
namespace Cecil\Renderer;

use Cecil\Collection\Page\Page as PageItem;
use Cecil\Config;

/**
* Class Renderer\Page.
Expand All @@ -24,7 +23,7 @@ class Page
/** @var \Cecil\Config */
protected $config;

public function __construct(Config $config)
public function __construct(\Cecil\Config $config)
{
$this->config = $config;
}
Expand Down

0 comments on commit e2f06bf

Please sign in to comment.