Since a new project is going on at work, which will be built using NEOS I thought I'd share a quick tip on how to modify the backend login of your NEOS page.
I was setting up the initial page, finally on PHP7 and using NEOS 4, and wondered how to change the backend login screen. I mean it's pretty nice with its fullscreen background and all. And this will surely be sufficient for a personal blog page and such. However this NEOS site will be for a client. So the goal was to make them feel "at home" by using their corporate identity.
Googling around let to a page in the official NEOS documentation which stated how you could change the background-image or inject your own stylesheet. That will probably be enough for most of you. Just change the background-image or disable it; load additional stylesheets or disable the default one completely. However this leaves the markup untouched, meaning there will still be this big NEOS logo for example and all neos
prefixed css classes. I needed to replace the logo with the clients logo and also use css classes which we had already defined for the rest of the page (= the frontend) to not reinvent the wheel.
Scanning the files of NEOS you will find an LoginController.php file containing a LoginController
class. Looking through the code you'll find an indexAction
that makes you guess that this is the action used for the backend login. Following the view resolver convention this makes you think there is a template file somewhere called Login/Index.html - and there is. It is located in Packages/Application/Neos.Neos./Resources/Private/Templates/Login/Index.html. Looking into this file will vanish any doubt: this is the used template. Of course you would never change the markup directly in this file, since your changes would get lost, when the package is updated.
Therefore copy the file to you own package, i.e. to Packages/Sites/Vendor.AcmeCom/Resources/Pirvate/Templates/Login/Index.html.
Unfortunately this file is not magically used. You will have to tell NEOS, that this template should be used when the LoginController's indexAction is invoked. That was a no-brainer up to here.
For the next step I googled for like two hours. It turned out again that you really need to be fit in developing with the Flow Framework, which NEOS is based upon.
In the docs it's stated, that you can put a file named Views.yaml into your Configuration-folder. In our case this would reside here: Packages/Sites/Vendor.AcmeCom/Configuration/Views.yaml.
Put the following code in this file to hint NEOS where to find you template file:
-
requestFilter: 'isPackage("Neos.Neos") && isController("Login")'
options:
templateRootPathPattern: 'resource://Vendor.AcmeCom/Private/Templates/'
Don't forget to clear the caches afterwards via the CLI-tool:
$ ~ ./flow flow:cache:flush --force
Then you are good to go. Modify the markup in your template file and check how it looks.