Skip to content

Instantly share code, notes, and snippets.

View nishantkumar155's full-sized avatar

Nishant kumar nishantkumar155

View GitHub Profile
<?php
namespace Drupal\okgoogle\Controller;
use Drupal\Core\Controller\ControllerBase;
use Drupal\Core\Logger\LoggerChannelFactoryInterface;
use Symfony\Component\DependencyInjection\ContainerInterface;
use Symfony\Component\HttpFoundation\JsonResponse;
use Symfony\Component\HttpFoundation\RequestStack;
@nishantkumar155
nishantkumar155 / okgoogle..routing.yml
Created May 4, 2018 05:57
How to integrate Google Assistant with Drupal 8
okgoogle.test:
path: '/ok-google-test'
defaults:
_controller: '\Drupal\okgoogle\Controller\test::handleRequest'
_title: 'Ok Google'
requirements:
_access: 'TRUE'
server {
listen 80;
#listen [::]:80 default_server;
root /var/www/html/d8/;
#root /var/www/ah/4score/4score-may-23-new/html;
#root /var/www/ah/4score/4score-pantheon;
#
server {
listen 80 default_server;
listen [::]:80 default_server;
# SSL configuration
#
# listen 443 ssl default_server;
# listen [::]:443 ssl default_server;
#
<?php
$local_sites = '/var/www/html/';
$scan = scandir($local_sites);
unset($scan[0]);
unset($scan[1]);
foreach($scan as $projects){
$aliases[$projects] = array(
'root' => $local_sites . $projects,
'path-aliases' => array(
'%dump-dir' => $local_sites . 'drush.dbdumps',
<?php
/**
* @file
* settings.local.php.
*/
// Local development configuration.
if (!defined('PANTHEON_ENVIRONMENT')) {
<?php
/**
* Implements hook_views_data_alter().
*/
function MODULENAME_views_data_alter(array &$data) {
$data['node']['views_field'] = array(
'title' => t('views_field'),
'field' => array(
'title' => t('views_field'),
'help' => t('To views_field'),
<?php
/**
* @file
* Contains \Drupal\MOUDULENAME\Plugin\views\field\CategoryReturn.
*/
namespace Drupal\MOUDULENAME\Plugin\views\field;
use Drupal\Core\Form\FormStateInterface;
use Drupal\node\Entity\NodeType;