Skip to content

Instantly share code, notes, and snippets.

View mcortes19's full-sized avatar
🏠
Working from home

Marvin J. Cortés mcortes19

🏠
Working from home
View GitHub Profile
@ozin7
ozin7 / Controller.php
Last active March 7, 2024 17:56
Drupal 8: Dependency injection in Service, Controller, Plugin, Deriver.
<?php
/**
* Controller. Implements ContainerInjectionInterface
*/
namespace Drupal\gurei\Controller;
use Drupal\Core\Controller\ControllerBase;
use Drupal\Core\DependencyInjection\ContainerInjectionInterface;
use Drupal\gurei\Service\CompanyService;
use Symfony\Component\DependencyInjection\ContainerInterface;
@pcambra
pcambra / custom_pane_panelizer.php
Created May 10, 2018 00:43
How to add a pane to a node with panelizer programmatically
<?php
// This code can be used in a hook_update_n to add a custom pane to an existing display in panelizer.
// Example variables used in the code below.
$nid = 1;
$pane_machine_name = 'my_example_custom_pane';
$region = 'content';
$position = 0;