Skip to content

Instantly share code, notes, and snippets.

@wiratama
wiratama / ThemeNegotiator.php
Created April 4, 2019 02:40 — forked from jimconte/ThemeNegotiator.php
A sample class implementation of Drupal 8's ThemeNegotiatorInterface from https://jimconte.com/blog/web/dynamic-theme-switching-in-drupal-8
<?php
/**
* @file
* Contains \Drupal\jcmodule\Theme\ThemeNegotiator
*/
namespace Drupal\jcmodule\Theme;
use Drupal\Core\Routing\RouteMatchInterface;
use Drupal\Core\Theme\ThemeNegotiatorInterface;
Creating custom table in drupal 8 is not recommended. Create entity types instead.
But if you want to Create custom table you can create either by implementing hook_schema or
else create schema file config/schema/your_custom_module_name.schema.yml in your module
(https://www.drupal.org/docs/8/api/configuration-api/configuration-schemametadata).
( https://drupal.stackexchange.com/questions/219580/best-practice-for-creating-table-in-custom-module )
1. Implementing hook_schema in .module file (Not recommended).
/**
@wiratama
wiratama / backup.bat
Created October 31, 2018 15:43 — forked from malkitsingh/backup.bat
batch file to run mongodb daily tasks
@echo off
REM move into the backups directory
CD C:\backup
REM Create a file name for the database output which contains the date and time. Replace any characters which might cause an issue.
set filename=database %date% %time%
set filename=%filename:/=-%
set filename=%filename: =__%
set filename=%filename:.=_%