In drupal 8 for logging we use logger service, to log array data in some readable format, you should use little hack like in drupal 7 adding html code and print_r to array.
In drupal 8 for logging we use logger service, to log array data in some readable format, you should use little hack like in drupal 7 adding html code and print_r to array.
I wrote about this great drupal find http://drupaldump.com/drush-cutie-about-minute-install-full-instance-dr…
but what was not obvious is how to reuse this drupal installation. Once you close terminal window, server closes and it doesn't work. There is a command
I stumbled upon a great find, Drush Cutie. What it does is takes advantage of PHP's built-in web server (PHP >= 5.4) and uses a sqlite database to get a fresh, stand-alone copy of Drupal up and running, all in about a minute.
use Drupal\Core\Controller\ControllerBase;
use Drupal\my_module\SomeClass;
use Symfony\Component\DependencyInjection\ContainerInterface;
use Symfony\Component\HttpFoundation\Response;
class SomeController extends ControllerBase
{
private $someProperty;
public function __construct(SomeClass $someProperty)
{
Getting into drupal 8 from drupal 7 is hard. Especially if you are new to OOP, some articles about what is what will help you on that way. I suggest the following in that order
Still new to this drupal 8 beast and trying to learn how to drill down data from entites. There are this magic getters and setters methods that get you data without need to write them. So
I wanted to add a message to orders when I did some auto approving of orders. To add some trace of that you need to load user which will be the one that did that. Send $values that will be used for token replacement in message and also select which message type you are going to use. In here I made a clone of default message "commerce_order_admin_comment" and used that.
Often I have a need to alter a bit output of a view, either the markup or just query, it's important to know where to hook in a life of a view, here is the list of hooks and alters.
In includes/module.inc, find the module_implements() function (around line 715 in Drupal 7). At the top of the function, just add this below and you will get huge output of all the hooks that are called.
function module_implements($hook, $sort = FALSE, $reset = FALSE) {
drupal_set_message("hook_$hook");
......
This is a hack on how to get output of which theme function to call to alter each element on page. So you will need to go to In includes/theme.inc in the Drupal 7 theme() function, around line 1161 and change $output from one line to two lines and to have this code below. You will get theme suggestions all around the page, which will be messy but will help you find what you need.