PHP

Drupa 8 Custom Drush Command

If you need to create a custom drush command here is how this example Sets the home page via path not via node id (this one uses another core drush command)

First you need a module and a file in it that is has .drush.inc at the end of it

Example mymodule.drush.inc

then you need to do some thing like this:

Drual 8 Webform as internal Notification System

Drupal 8 Webform Is Awesome ! (formally known as ymalform)  the idea of having a internal notification system is a cool idea and some times you need to implement it ...
lets see an example of how you would do it with the webform module

so first you need to figure out when you want to send an notification and then to who ... this will most likely come in the form of EventSubscribers see http://taggartjensen.com/code-snip/drupal-8-workbench-eventsubscriber-example

Drupal 8 WorkBench EventSubscriber Example

Drupal 8 Event subscriber example for work bench moderation module.
say you want to do some thing when a work bench state changes ... this will get the logged in user vs the node content creator and get there enmails etc.

Service File:

services:
  test_even_subscriber.default:
    class: Drupal\test_even_subscriber\EventSubscriber\DefaultSubscriber
    arguments: ['@current_user']
    tags:
      - { name: event_subscriber }


Drupal\test_even_subscriber\EventSubscriber\DefaultSubscriber.php

Drupal 8 Custom form display Modes

ok to get custom form display modes working in your module .... after some time of messing with this I seem to have it working:
and here is how...

1) create your form display and get id from url
at :admin/structure/display-modes/form/manage/

"Test This" gives m name ... node.test_this

in your modules
my_module.routing.yml

Drupal 8 inline_template in a form example

in your module file

<?php
/**
 * Implements hook_theme().
 */
function mymodule_theme($existing, $type, $theme, $path) {
  return [
    'application_dialog_box' => [
      'variables' => [
        'diolog_id' => 'na',
        'diolog_title' => 'na',
        'diolog_text' => 'na',
       'someother_thing' => [],
      ],
      'template' => 'application-dialog-box',
    ],
  ];
}

?>

 

in your form or alter