Compare commits
No commits in common. "43b5f0c14b417f7a068596906f9ca13708249b3d" and "c3e777f53bc854fb37e4e25641604faaabc038b9" have entirely different histories.
43b5f0c14b
...
c3e777f53b
14 changed files with 0 additions and 294 deletions
|
@ -1,10 +0,0 @@
|
||||||
steps:
|
|
||||||
code-style:
|
|
||||||
image: composer
|
|
||||||
commands:
|
|
||||||
- composer global config repositories.repo-name vcs https://git.digital-competence.de/Packages/php-codesniffer
|
|
||||||
- composer global config --no-plugins allow-plugins.dealerdirect/phpcodesniffer-composer-installer true
|
|
||||||
- composer global require digicomp/php-codesniffer:@dev
|
|
||||||
- composer global exec -- phpcs --runtime-set ignore_warnings_on_exit 1 --standard=DigiComp Classes/ Tests/
|
|
||||||
when:
|
|
||||||
- event: [push, pull_request, manual]
|
|
|
@ -1,34 +0,0 @@
|
||||||
workspace:
|
|
||||||
base: /woodpecker
|
|
||||||
path: package
|
|
||||||
|
|
||||||
matrix:
|
|
||||||
include:
|
|
||||||
- FLOW_VERSION: 6.3
|
|
||||||
PHP_VERSION: 7.4
|
|
||||||
- FLOW_VERSION: 7.3
|
|
||||||
PHP_VERSION: 7.4
|
|
||||||
- FLOW_VERSION: 7.3
|
|
||||||
PHP_VERSION: 8.2
|
|
||||||
- FLOW_VERSION: 8.2
|
|
||||||
PHP_VERSION: 8.2
|
|
||||||
|
|
||||||
steps:
|
|
||||||
functional-tests:
|
|
||||||
image: "thecodingmachine/php:${PHP_VERSION}-v4-cli"
|
|
||||||
environment:
|
|
||||||
# Enable the PDO_SQLITE extension
|
|
||||||
- "PHP_EXTENSION_PDO_SQLITE=1"
|
|
||||||
- "FLOW_VERSION=${FLOW_VERSION}"
|
|
||||||
- "NEOS_BUILD_DIR=/woodpecker/Build-${FLOW_VERSION}"
|
|
||||||
commands:
|
|
||||||
- "sudo mkdir $NEOS_BUILD_DIR"
|
|
||||||
- "sudo chown -R docker:docker $NEOS_BUILD_DIR"
|
|
||||||
- "cd $NEOS_BUILD_DIR"
|
|
||||||
- "composer create-project --no-install neos/flow-base-distribution:^$FLOW_VERSION ."
|
|
||||||
- "composer config repositories.repo-name path /woodpecker/package"
|
|
||||||
- "composer remove --dev --no-update neos/behat || composer remove --no-update neos/behat"
|
|
||||||
- "composer require digicomp/fluid-currentcontroller-expression:@dev"
|
|
||||||
- "bin/phpunit --configuration Build/BuildEssentials/PhpUnit/FunctionalTests.xml Packages/Application/DigiComp.FluidCurrentControllerExpression/Tests/Functional"
|
|
||||||
when:
|
|
||||||
- event: [ push, pull_request, manual ]
|
|
|
@ -1,41 +0,0 @@
|
||||||
<?php
|
|
||||||
|
|
||||||
declare(strict_types=1);
|
|
||||||
|
|
||||||
namespace DigiComp\FluidCurrentControllerExpression;
|
|
||||||
|
|
||||||
use Neos\FluidAdaptor\Core\Rendering\RenderingContext;
|
|
||||||
use Neos\Utility\ObjectAccess;
|
|
||||||
use TYPO3Fluid\Fluid\Core\Parser\SyntaxTree\Expression\AbstractExpressionNode;
|
|
||||||
use TYPO3Fluid\Fluid\Core\Parser\SyntaxTree\Expression\ExpressionNodeInterface;
|
|
||||||
use TYPO3Fluid\Fluid\Core\Rendering\RenderingContextInterface;
|
|
||||||
|
|
||||||
class CurrentControllerExpressionNode extends AbstractExpressionNode implements ExpressionNodeInterface
|
|
||||||
{
|
|
||||||
/**
|
|
||||||
* note: this could be readonly in PHP8
|
|
||||||
* @var string
|
|
||||||
*/
|
|
||||||
public static string $detectionExpression = '/\{#currentController\.([a-zA-Z0-9\.]+)\}/';
|
|
||||||
|
|
||||||
public static function evaluateExpression(RenderingContextInterface $renderingContext, $expression, array $matches)
|
|
||||||
{
|
|
||||||
if ($renderingContext instanceof RenderingContext) {
|
|
||||||
$propertyToReturn = $matches[1];
|
|
||||||
if (
|
|
||||||
\in_array(
|
|
||||||
$propertyToReturn,
|
|
||||||
['actionName', 'name', 'objectName', 'packageKey', 'subpackageKey'],
|
|
||||||
true
|
|
||||||
)
|
|
||||||
) {
|
|
||||||
$propertyToReturn = 'controller' . \ucfirst($propertyToReturn);
|
|
||||||
}
|
|
||||||
return ObjectAccess::getPropertyPath(
|
|
||||||
$renderingContext->getControllerContext()->getRequest(),
|
|
||||||
$propertyToReturn
|
|
||||||
);
|
|
||||||
}
|
|
||||||
return '';
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,9 +0,0 @@
|
||||||
Neos\FluidAdaptor\Core\Rendering\RenderingContext:
|
|
||||||
properties:
|
|
||||||
expressionNodeTypes:
|
|
||||||
value:
|
|
||||||
- Neos\FluidAdaptor\Core\Parser\SyntaxTree\Expression\LegacyNamespaceExpressionNode
|
|
||||||
- TYPO3Fluid\Fluid\Core\Parser\SyntaxTree\Expression\CastingExpressionNode
|
|
||||||
- TYPO3Fluid\Fluid\Core\Parser\SyntaxTree\Expression\MathExpressionNode
|
|
||||||
- TYPO3Fluid\Fluid\Core\Parser\SyntaxTree\Expression\TernaryExpressionNode
|
|
||||||
- DigiComp\FluidCurrentControllerExpression\CurrentControllerExpressionNode
|
|
|
@ -1,7 +0,0 @@
|
||||||
-
|
|
||||||
requestFilter: 'isFormat("html") && isPackage("DigiComp.FluidCurrentControllerExpression")'
|
|
||||||
options:
|
|
||||||
layoutRootPaths:
|
|
||||||
- "resource://DigiComp.FluidCurrentControllerExpression/Private/Layouts"
|
|
||||||
partialRootPaths:
|
|
||||||
- "resource://DigiComp.FluidCurrentControllerExpression/Private/Partials"
|
|
19
License.txt
19
License.txt
|
@ -1,19 +0,0 @@
|
||||||
Copyright (c) 2024 Ferdinand Kuhl <f.kuhl@digital-competence.de>
|
|
||||||
|
|
||||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
||||||
of this software and associated documentation files (the "Software"), to deal
|
|
||||||
in the Software without restriction, including without limitation the rights
|
|
||||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
||||||
copies of the Software, and to permit persons to whom the Software is
|
|
||||||
furnished to do so, subject to the following conditions:
|
|
||||||
|
|
||||||
The above copyright notice and this permission notice shall be included in
|
|
||||||
all copies or substantial portions of the Software.
|
|
||||||
|
|
||||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
||||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
||||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
||||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
||||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
||||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
|
||||||
THE SOFTWARE.
|
|
13
README.md
13
README.md
|
@ -1,13 +0,0 @@
|
||||||
# DigiComp.FluidCurrentControllerExpression
|
|
||||||
|
|
||||||
This extends the fluid language with an expression to allow you to access values of the current action request.
|
|
||||||
|
|
||||||
```html
|
|
||||||
<html>
|
|
||||||
<title>Welcome to {#currentController.name} {#currentController.actionName}</title>
|
|
||||||
</html>
|
|
||||||
```
|
|
||||||
|
|
||||||
The pattern is `{#currentController.PROPERTY_OF_ACTIONREQUEST}` - all properties are possible. To avoid duplicated "controller" in the expression you are allowed to omit them (even if it works, if you do not).
|
|
||||||
|
|
||||||
It is really helpful if you try to generalize partials - being an expression, it is not depending on any aliased namespace, which might change in deeper structures.
|
|
|
@ -1 +0,0 @@
|
||||||
<f:render section="Content" />
|
|
|
@ -1,6 +0,0 @@
|
||||||
<f:render section="Test" arguments="{controllername: '{#currentController.name}'}" /><f:section name="Test">{controllername}
|
|
||||||
{#currentController.actionName}
|
|
||||||
{#currentController.packageKey}
|
|
||||||
{#currentController.subpackageKey}
|
|
||||||
{#currentController.objectName}
|
|
||||||
{#currentController.format}</f:section>
|
|
|
@ -1,6 +0,0 @@
|
||||||
{#currentController.name}
|
|
||||||
{#currentController.actionName}
|
|
||||||
{#currentController.packageKey}
|
|
||||||
{#currentController.subpackageKey}
|
|
||||||
{#currentController.objectName}
|
|
||||||
{#currentController.format}
|
|
|
@ -1,7 +0,0 @@
|
||||||
<f:layout name="Test" />
|
|
||||||
<f:section name="Content">{#currentController.name}
|
|
||||||
{#currentController.actionName}
|
|
||||||
{#currentController.packageKey}
|
|
||||||
{#currentController.subpackageKey}
|
|
||||||
{#currentController.objectName}
|
|
||||||
{#currentController.format}</f:section>
|
|
|
@ -1,84 +0,0 @@
|
||||||
<?php
|
|
||||||
|
|
||||||
declare(strict_types=1);
|
|
||||||
|
|
||||||
namespace DigiComp\FluidCurrentControllerExpression\Tests\Functional;
|
|
||||||
|
|
||||||
use Neos\Flow\Mvc\Routing\Route;
|
|
||||||
use Neos\Flow\Tests\FunctionalTestCase;
|
|
||||||
|
|
||||||
class CurrentControllerExpressionNodeTest extends FunctionalTestCase
|
|
||||||
{
|
|
||||||
/**
|
|
||||||
* Initializer
|
|
||||||
*/
|
|
||||||
protected function setUp(): void
|
|
||||||
{
|
|
||||||
parent::setUp();
|
|
||||||
|
|
||||||
$route = new Route();
|
|
||||||
$route->setUriPattern('test/currentcontrollerexpressions/test(/{@action})');
|
|
||||||
$route->setDefaults([
|
|
||||||
'@package' => 'DigiComp.FluidCurrentControllerExpression',
|
|
||||||
'@subpackage' => 'Tests\Functional\Fixtures',
|
|
||||||
'@controller' => 'Test',
|
|
||||||
'@action' => 'index',
|
|
||||||
]);
|
|
||||||
$route->setAppendExceedingArguments(true);
|
|
||||||
$this->router->addRoute($route);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @test
|
|
||||||
*/
|
|
||||||
public function itReturnsCurrentControllerInformations(): void
|
|
||||||
{
|
|
||||||
$response = $this->browser->request('http://localhost/test/currentcontrollerexpressions/test');
|
|
||||||
static::assertEquals(
|
|
||||||
'Test
|
|
||||||
index
|
|
||||||
DigiComp.FluidCurrentControllerExpression
|
|
||||||
Tests\Functional\Fixtures
|
|
||||||
DigiComp\FluidCurrentControllerExpression\Tests\Functional\Fixtures\Controller\TestController
|
|
||||||
html
|
|
||||||
',
|
|
||||||
(string)$response->getBody()
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @test
|
|
||||||
*/
|
|
||||||
public function itReturnsCurrentControllerInformationsUsedInLayouts(): void
|
|
||||||
{
|
|
||||||
$response = $this->browser->request('http://localhost/test/currentcontrollerexpressions/test/withlayout');
|
|
||||||
static::assertEquals(
|
|
||||||
'Test
|
|
||||||
withLayout
|
|
||||||
DigiComp.FluidCurrentControllerExpression
|
|
||||||
Tests\Functional\Fixtures
|
|
||||||
DigiComp\FluidCurrentControllerExpression\Tests\Functional\Fixtures\Controller\TestController
|
|
||||||
html
|
|
||||||
',
|
|
||||||
(string)$response->getBody()
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @test
|
|
||||||
*/
|
|
||||||
public function itReturnsCurrentControllerInformationsUsedInArrays(): void
|
|
||||||
{
|
|
||||||
$response = $this->browser->request('http://localhost/test/currentcontrollerexpressions/test/inArrays');
|
|
||||||
static::assertEquals(
|
|
||||||
'Test
|
|
||||||
inArrays
|
|
||||||
DigiComp.FluidCurrentControllerExpression
|
|
||||||
Tests\Functional\Fixtures
|
|
||||||
DigiComp\FluidCurrentControllerExpression\Tests\Functional\Fixtures\Controller\TestController
|
|
||||||
html
|
|
||||||
',
|
|
||||||
(string)$response->getBody()
|
|
||||||
);
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,22 +0,0 @@
|
||||||
<?php
|
|
||||||
|
|
||||||
declare(strict_types=1);
|
|
||||||
|
|
||||||
namespace DigiComp\FluidCurrentControllerExpression\Tests\Functional\Fixtures\Controller;
|
|
||||||
|
|
||||||
use Neos\Flow\Mvc\Controller\ActionController;
|
|
||||||
|
|
||||||
class TestController extends ActionController
|
|
||||||
{
|
|
||||||
public function indexAction()
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
public function withLayoutAction()
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
public function inArraysAction()
|
|
||||||
{
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,35 +0,0 @@
|
||||||
{
|
|
||||||
"name": "digicomp/fluid-currentcontroller-expression",
|
|
||||||
"type": "neos-package",
|
|
||||||
"description": "Extends fluid with expressions to retrieve current's ActionRequest values",
|
|
||||||
"require": {
|
|
||||||
"php": "^7.4 | ^8.1",
|
|
||||||
"neos/flow": "^6.3 | ^7.3 | ^8.2",
|
|
||||||
"neos/fluid-adaptor": "^6.3 | ^7.3 | ^8.3"
|
|
||||||
},
|
|
||||||
"extra":{
|
|
||||||
"branch-alias": {
|
|
||||||
"dev-develop": "1.0.x-dev"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"autoload": {
|
|
||||||
"psr-4": {
|
|
||||||
"DigiComp\\FluidCurrentControllerExpression\\": "Classes/"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"authors": [
|
|
||||||
{
|
|
||||||
"name": "Ferdinand Kuhl",
|
|
||||||
"email": "f.kuhl@digital-competence.de",
|
|
||||||
"homepage": "https://www.digital-competence.de",
|
|
||||||
"role": "Developer"
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"license": "MIT",
|
|
||||||
"homepage": "https://git.digital-competence.de/Packages/DigiComp.FluidCurrentControllerExpression",
|
|
||||||
"keywords": [
|
|
||||||
"Neos",
|
|
||||||
"Flow",
|
|
||||||
"fluid"
|
|
||||||
]
|
|
||||||
}
|
|
Loading…
Reference in a new issue