Skip to content

Instantly share code, notes, and snippets.


Rakesh James rakeshjames

View GitHub Profile
View demouser_migrate_multipleRoles.csv
ID name email firstname lastname Status roles Password
1 rakesh Rakesh James 1 administrator,migrationuser rakesh@123
2 james James Rakesh 1 authenticated james@123
3 dummy Dummy User 1 migrationuser,administrator dummy@123
View demo_user_migrate.yml
id: demo_user_migration
migration_tags: null
migration_group: null
label: 'User migration from CSV'
plugin: csv
path: /Library/WebServer/Documents/d8/sites/default/files/demousers_migrate.csv
header_row_count: 1
- ID
View demousers_migrate.csv
ID name email firstname lastname Status roles
1 rakesh Rakesh James 1 administrator
2 james James Rakesh 1 authenticated
3 dummy Dummy User 1 testuser
class: Drupal\example_events\EventSubscriber\ExampleEventSubScriber
- { name: 'event_subscriber' }
View ExampleEventSubscriber.php
* @file
* Contains \Drupal\example_events\ExampleEventSubScriber.
namespace Drupal\example_events\EventSubscriber;
use Drupal\Core\Config\ConfigCrudEvent;
View DemoEventDispatchForm.php
* @file
* Contains \Drupal\example_events\Form\DemoEventDispatchForm.
namespace Drupal\example_events\Form;
use Drupal\Core\Form\FormBase;
rakeshjames / example_dispatching_an_example_event.php
Created July 14, 2016 20:50
Example for how to dispatch an example event in Drupal 8?
View example_dispatching_an_example_event.php
// Following is the example for How to dispatch an event in Drupal 8?
// Use the namespace of the ExampleEvent class
use Drupal\example_events\ExampleEvent;
// load the Symfony event dispatcher object through services
$dispatcher = \Drupal::service('event_dispatcher');
// creating our event class object.
View ExampleEvent.php
namespace Drupal\example_events;
use Symfony\Component\EventDispatcher\Event;
class ExampleEvent extends Event {
const SUBMIT = 'event.submit';
protected $referenceID;