Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 0 additions & 10 deletions .tools/phpstan/baseline/missingType.iterableValue.php
Original file line number Diff line number Diff line change
Expand Up @@ -33,16 +33,6 @@
'count' => 1,
'path' => __DIR__ . '/../../../addons/debug/lib/extensions/extension_debug.php',
];
$ignoreErrors[] = [
'rawMessage' => 'Method Redaxo\\Core\\Backend\\Controller::pageAddProperties() has parameter $properties with no value type specified in iterable type array.',
'count' => 1,
'path' => __DIR__ . '/../../../src/Backend/Controller.php',
];
$ignoreErrors[] = [
'rawMessage' => 'Method Redaxo\\Core\\Backend\\Controller::pageCreate() has parameter $page with no value type specified in iterable type array.',
'count' => 1,
'path' => __DIR__ . '/../../../src/Backend/Controller.php',
];
$ignoreErrors[] = [
'rawMessage' => 'Method Redaxo\\Core\\Content\\ArticleHandler::addArticle() has parameter $data with no value type specified in iterable type array.',
'count' => 1,
Expand Down
32 changes: 0 additions & 32 deletions .tools/psalm/baseline.xml
Original file line number Diff line number Diff line change
Expand Up @@ -1491,41 +1491,9 @@
</MixedAssignment>
</file>
<file src="src/Backend/Controller.php">
<MixedArgument>
<code><![CDATA[$addon->getProperty('page')]]></code>
<code><![CDATA[$page]]></code>
<code><![CDATA[$page]]></code>
<code><![CDATA[$pageArray['title']]]></code>
<code><![CDATA[$pageArray['title']]]></code>
<code><![CDATA[$subProperties['title']]]></code>
<code><![CDATA[$value]]></code>
<code><![CDATA[$value]]></code>
</MixedArgument>
<MixedArgumentTypeCoercion>
<code><![CDATA[$key]]></code>
<code><![CDATA[$key]]></code>
<code><![CDATA[$key]]></code>
<code><![CDATA[$key]]></code>
<code><![CDATA[$key]]></code>
<code><![CDATA[$key]]></code>
<code><![CDATA[$pageKey]]></code>
</MixedArgumentTypeCoercion>
<MixedAssignment>
<code><![CDATA[$k]]></code>
<code><![CDATA[$page]]></code>
<code><![CDATA[$page]]></code>
<code><![CDATA[$pages]]></code>
<code><![CDATA[$subProperties]]></code>
<code><![CDATA[$v]]></code>
<code><![CDATA[$v]]></code>
<code><![CDATA[$value]]></code>
</MixedAssignment>
<PossiblyFalseArgument>
<code><![CDATA[ini_get('error_log')]]></code>
</PossiblyFalseArgument>
<PossiblyInvalidArgument>
<code><![CDATA[$subProperties]]></code>
</PossiblyInvalidArgument>
</file>
<file src="src/Backend/Page.php">
<PossiblyNullArgument>
Expand Down
8 changes: 0 additions & 8 deletions addons/debug/package.yml

This file was deleted.

16 changes: 16 additions & 0 deletions addons/debug/src/DebugAddon.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,9 @@
use Override;
use Redaxo\Core\Addon\Addon;
use Redaxo\Core\Addon\LoadOrder;
use Redaxo\Core\Backend\MainPage;
use Redaxo\Core\Core;
use Redaxo\Core\Translation\I18n;

final class DebugAddon extends Addon
{
Expand All @@ -16,6 +19,19 @@ public function boot(): void
$this->includeFile('boot.php');
}

#[Override]
public function getPages(): iterable
{
if (Core::isLiveMode()) {
return;
}

yield new MainPage('system', $this->name, I18n::msg('debug'))
->setRequiredPermissions('admin')
->setIcon('rex-icon rex-icon-heartbeat')
->setLinkAttr('target', '_blank');
}

#[Override]
public function install(): void
{
Expand Down
196 changes: 1 addition & 195 deletions schemas/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,204 +4,10 @@
"title": "JSON schema for REDAXO package.yml",
"type": "object",
"properties": {
"page": {
"description": "Main page",
"$ref": "#/definitions/main-page"
},
"pages": {
"description": "Additional pages",
"type": "object",
"patternProperties": {
"^[^/]*$": {
"$ref": "#/definitions/main-page"
}
},
"additionalProperties": {
"$ref": "#/definitions/page"
}
},
"default_config": {
"description": "Default values for Redaxo\\Core\\Config",
"type": "object"
}
},
"additionalProperties": true,
"definitions": {
"page-base": {
"type": "object",
"required": ["title"],
"properties": {
"title": {
"description": "Page title",
"type": "string"
},
"hidden": {
"description": "Whether the page is hidden",
"type": "boolean",
"default": true
},
"hasLayout": {
"description": "Whether the page has layout",
"type": "boolean",
"default": false
},
"hasNavigation": {
"description": "Whether the page has the navigation",
"type": "boolean",
"default": false
},
"popup": {
"description": "Whether the page is a popup",
"oneOf": [
{
"type": "boolean",
"default": true
},
{
"description": "onclick attribute",
"type": "string"
}
]
},
"pjax": {
"description": "Whether the page uses pjax",
"type": "boolean",
"default": true
},
"perm": {
"description": "Page permission",
"type": "string",
"default": "admin"
},
"live_mode": {
"description": "Live mode",
"type": "boolean",
"default": true
},
"icon": {
"description": "Icon class name(s)",
"type": "string"
},
"href": {
"description": "href attribute",
"oneOf": [
{
"type": "string"
},
{
"description": "href params",
"type": "object"
}
]
},
"itemAttr": {
"description": "Attributes for the list item",
"type": "object"
},
"itemClass": {
"description": "class attributes for the list item",
"type": "string"
},
"linkAttr": {
"description": "Attributes for the link",
"type": "object"
},
"linkClass": {
"description": "class attributes for the link",
"type": "string"
},
"path": {
"description": "Path to the main page file",
"type": "string",
"pattern": "\\.php$"
},
"subPath": {
"description": "Path to the subpage file",
"type": "string",
"pattern": "\\.(php|md)$"
},
"subpages": {
"description": "Subpages",
"patternProperties": {
"^[^/]+$": {
"$ref": "#/definitions/page"
}
},
"additionalProperties": false
}
}
},
"page": {
"allOf": [
{
"$ref": "#/definitions/page-base"
}
],
"properties": {
"title": true,
"hidden": true,
"hasLayout": true,
"hasNavigation": true,
"popup": true,
"pjax": true,
"perm": true,
"icon": true,
"href": true,
"itemAttr": true,
"itemClass": true,
"linkAttr": true,
"linkClass": true,
"path": true,
"subPath": true,
"subpages": true
},
"additionalProperties": false
},
"main-page": {
"allOf": [
{
"$ref": "#/definitions/page-base"
}
],
"properties": {
"title": true,
"hidden": true,
"hasLayout": true,
"hasNavigation": true,
"popup": true,
"pjax": true,
"perm": true,
"icon": true,
"href": true,
"itemAttr": true,
"itemClass": true,
"linkAttr": true,
"linkClass": true,
"path": true,
"subPath": true,
"subpages": true,
"main": {
"description": "Whether it is a main page",
"type": "boolean",
"default": true
},
"block": {
"description": "Block name",
"anyOf": [
{
"enum": ["system", "addons"]
},
{
"type": "string"
}
]
},
"prio": {
"description": "Page prio",
"type": "integer"
}
},
"additionalProperties": false
}
}
"additionalProperties": true
}
17 changes: 17 additions & 0 deletions src/Addon/Addon.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
use Composer\InstalledVersions;
use OutOfBoundsException;
use Redaxo\Core\Addon\ExtensionPoint\AddonCacheDeleted;
use Redaxo\Core\Backend\Page;
use Redaxo\Core\Config;
use Redaxo\Core\Core;
use Redaxo\Core\Exception\RuntimeException;
Expand Down Expand Up @@ -445,6 +446,22 @@ final public function enlist(): void
/** Boot hook — runs on every request after all addons are enlisted. Override to register listeners etc. */
public function boot(): void {}

/**
* Backend page hook — override to register the addon's backend pages.
*
* Runs only in the backend, after the core pages and all earlier-loading addons have been registered, so
* Controller::getPageObject() can be used to attach subpages to existing core or addon pages. Top-level pages
* are typically MainPage instances (shown in the navigation); a plain Page can be used for hidden entry points
* that are reachable by key/URL but should not appear in the navigation. Any page without an explicit path falls
* back to the convention `pages/<key>.php` (or `pages/index.php` for the main page whose key equals the addon name).
*
* @return iterable<Page>
*/
public function getPages(): iterable
{
return [];
}

/**
* Install hook — runs on install/reinstall. Override for schema/data setup. Must be idempotent.
*
Expand Down
Loading