Skip to content

Instantly share code, notes, and snippets.

🏠
Working from home

Bastian Waidelich bwaidelich

🏠
Working from home
Block or report user

Report or block bwaidelich

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@bwaidelich
bwaidelich / CacheFlusher.php
Last active Sep 2, 2019
Neos CMS: Get (relative) Node Url upon publishing
View CacheFlusher.php
<?php
namespace Some\Package;
use Neos\ContentRepository\Domain\Model\NodeInterface;
use Neos\ContentRepository\Domain\Model\Workspace;
use Neos\Eel\FlowQuery\FlowQuery;
use Neos\Flow\Annotations as Flow;
use Neos\Flow\Http\HttpRequestHandlerInterface;
use Neos\Flow\Mvc\ActionRequest;
use Neos\Flow\Mvc\Routing\UriBuilder;
@bwaidelich
bwaidelich / Jwt.php
Last active Aug 22, 2019
External authentication with Neos Flow and local JWT (http://jwt.io/) as cache
View Jwt.php
<?php
declare(strict_types=1);
namespace Your\Package\Security\Authentication;
use Neos\Flow\Annotations as Flow;
use Neos\Flow\Mvc\ActionRequest;
use Neos\Flow\Security\Authentication\Token\AbstractToken;
use Neos\Flow\Security\Authentication\Token\SessionlessTokenInterface;
/**
@bwaidelich
bwaidelich / Component_Atom_DefaultElement.fusion
Last active Jul 17, 2019
Atomic Fusion based Form Definition
View Component_Atom_DefaultElement.fusion
prototype(My.Package:Form.DefaultElement) < prototype(Neos.Fusion:Component) {
# API
id = ''
name = ''
label = ''
value = null
isRequired = false
properties = Neos.Fusion:RawArray
validationErrors = Neos.Fusion:RawArray
@bwaidelich
bwaidelich / JsonCapableExceptionView.php
Created Jun 19, 2019
Render Neos / Flow exceptions as JSON if a corresponding Accept / Content-Type header is set
View JsonCapableExceptionView.php
<?php
declare(strict_types=1);
namespace Some\Package\Error;
use Neos\Flow\Annotations as Flow;
use Neos\Flow\Http\Helper\ResponseInformationHelper;
use Neos\Flow\Http\Request;
use Neos\Flow\Mvc\Controller\ControllerContext;
use Neos\Flow\Mvc\View\ViewInterface;
use Neos\Utility\MediaTypes;
@bwaidelich
bwaidelich / SiteRequestPattern.php
Last active Jun 6, 2019
Neos Flow Authentication Provider Request Pattern matching Neos Sites by their node name
View SiteRequestPattern.php
<?php
declare(strict_types=1);
namespace Some\Package;
use Neos\Flow\Annotations as Flow;
use Neos\Flow\Mvc\ActionRequest;
use Neos\Flow\Mvc\RequestInterface;
use Neos\Flow\Security\Context;
use Neos\Flow\Security\Exception as SecurityException;
use Neos\Flow\Security\Exception\InvalidRequestPatternException;
@bwaidelich
bwaidelich / SomeCommandController.php
Created Mar 13, 2018
Neos Flow CLI Command to process entities in batches
View SomeCommandController.php
<?php
declare(strict_types=1);
namespace Some\Package\Command;
use Neos\Flow\Annotations as Flow;
use Neos\Flow\Cli\CommandController;
class SomeCommand extends CommandController
{
View AuthenticationContext.php
<?php
declare(strict_types=1);
namespace Some\Package\Security;
use Neos\Cache\CacheAwareInterface;
use Neos\Flow\Annotations as Flow;
/**
* @Flow\Scope("singleton")
*/
@bwaidelich
bwaidelich / PurifyViewHelper.php
Created Jul 20, 2015
Fluid ViewHelper integrating HTMLPurifier to sanitize/tidy HTML output
View PurifyViewHelper.php
<?php
namespace Your\Package\ViewHelpers\Format;
use TYPO3\Flow\Annotations as Flow;
use TYPO3\Fluid\Core\ViewHelper\AbstractViewHelper;
/**
* ViewHelper rendering the given HTML string through HTMLPurifier
*/
class PurifyViewHelper extends AbstractViewHelper {
@bwaidelich
bwaidelich / main.go
Last active Jan 31, 2019
Golang Value Object tests
View main.go
package main
import (
"fmt"
"regexp"
)
// EmailAddress Value Object
type EmailAddress string
@bwaidelich
bwaidelich / Root.fusion
Created Jan 15, 2019
Atomic Fusion: Content with TOC
View Root.fusion
prototype(Some.Package:Component.ContentWithToc) < prototype(Neos.Fusion:Component) {
blocks = Neos.Fusion:RawArray
renderer = afx`
<nav>
<ul>
<Neos.Fusion:Collection collection={props.blocks} itemName="block" @children="itemRenderer">
<li>
<a href={'#c-' + iterator.cycle}>{block.label}</a>
</li>
You can’t perform that action at this time.