Skip to content

Instantly share code, notes, and snippets.

@annikaC
annikaC / AccountEditRedirectController.php
Created September 29, 2016 14:03
Drupal 8 redirect user to own user edit page (for use in menu links)
<?php
namespace Drupal\yourmodule\Controller;
use Drupal\Core\Controller\ControllerBase;
use Symfony\Component\HttpFoundation\RedirectResponse;
/**
* A controller that redirects to the current user's edit account page.
@signalpoint
signalpoint / customController.php
Created July 23, 2015 21:52
Drupal 8 Output JSON
<?php
// ...
use Symfony\Component\HttpFoundation\Response;
// Then later on (inside your controller's class), you have a function used
// for the route_name (on a hook_menu() item in your .module file), this
// function can return a JSON response...