Skip to content

Instantly share code, notes, and snippets.

View henideepak's full-sized avatar
🎯
Focusing

Deepak Bhati henideepak

🎯
Focusing
  • DOTSQUARES GLOBAL CAPABILITY CENTER (GCC)
  • CP4-228, 229, Apparel Park, Mahal Road (Hare Krishna Marg) Jagatpura, Jaipur, Rajasthan, India 302017
View GitHub Profile
@henideepak
henideepak / create_file.php
Last active October 18, 2022 09:10 — forked from facine/__INDEX.txt
Drupal 8 - Examples
<?php
// Programmatically create files.
use Drupal\file\Entity\File;
$file = File::create([
'uid' => 1,
'filename' => 'logo.svg',
'uri' => 'public://page/logo.svg',
'status' => 1,
]);
@henideepak
henideepak / date picker
Last active November 1, 2017 07:29
datepicker
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>jQuery UI Datepicker - Display month &amp; year menus</title>
<link rel="stylesheet" href="//code.jquery.com/ui/1.12.1/themes/base/jquery-ui.css">
<link rel="stylesheet" href="bootstrap-datepicker.css">
<script src="https://code.jquery.com/jquery-1.12.4.js"></script>
<script src="https://code.jquery.com/ui/1.12.1/jquery-ui.js"></script>
@henideepak
henideepak / Drupal 8 Registration form and redirect Home page after show custom message.
Last active September 17, 2018 11:50
Drupal 8 Registration form and redirect Home page after show custom message.
use Drupal\Core\Form\FormStateInterface;
use Drupal\Core\Url;
use Symfony\Component\HttpFoundation\RedirectResponse;
use Drupal\Core\Messenger\MessengerInterface;
/**
* Implements hook_form_FORM_ID_alter().
*/
function MODULE_NAME_form_alter( array &$form, FormStateInterface $form_state, $form_id ) {
@henideepak
henideepak / Drupal 8 form submit show "Success! Dialogbox".
Created September 17, 2018 11:52
Drupal 8 form submit show "Success! Dialogbox".
use Drupal\Core\Form\FormStateInterface;
use Drupal\Core\Ajax\AjaxResponse;
use Drupal\Core\Ajax\OpenModalDialogCommand;
use Drupal\Core\Ajax\CloseModalDialogCommand;
use Drupal\Core\Ajex\RedirectCommand;
use Drupal\Core\Ajex\HtmlCommand;
use Drupal\Core\Url;
use Drupal\Core\Ajex\ReplaceCommand;
@henideepak
henideepak / Jquery Remove disabled attribut from submit form.
Created September 17, 2018 12:07
Jquery Remove disabled attribut from submit form.
//Jquery Remove disabled attribut from submit form. validate form without jquery validation.
<form>
<input type="text" class="form_field">
<input type="text" class="form_field">
<input type="email" class="form_field">
<input type="submit" class="sendButton">
</form>
<script>
$('.sendButton').prop('disabled', true);
@henideepak
henideepak / How to get radio button value javascript
Last active September 21, 2019 04:42
How to get radio button value javascript
<input type="radio" value="1" name="choice">Yes</input>
<input type="radio" value="2" name="choice">No</input>
You selected:
<label id="YesLabel"><p>You are select Yes</p></label>
<label id="NoLabel"><p>You are select No</p></label>
<script>
@henideepak
henideepak / hook.module
Created August 8, 2019 09:08
Drupal 8 user insert give default role
/*
* Impliment user insert give default role.
*/
function hook_user_insert(Drupal\Core\Entity\EntityInterface $entity) {
$entity->addRole('role_name');
$entity->save();
}
@henideepak
henideepak / Drupal 8 Composer Command
Last active September 21, 2019 04:42
Composer command
composer update drupal/core --with-dependencies
composer require drush/drush
composer require drupal/admin_toolbar
drush en admin_toolbar admin_toolbar_tools admin_toolbar_links_access_filter
@henideepak
henideepak / How to work c program in terminal command in ubuntu
Last active September 21, 2019 04:32
How to work c program in terminal command in ubuntu
How to work c program in terminal command in ubuntu
once you checked GCC version
command = gcc --version
install c compiler
command = sudo apt install build-essential
@henideepak
henideepak / create a watchdog table in drupal
Created October 9, 2019 05:09
create a watchdog table in drupal
CREATE TABLE `watchdog` (
`wid` int(11) NOT NULL auto_increment,
`uid` int(11) NOT NULL default '0',
`type` varchar(16) NOT NULL default '',
`message` longtext NOT NULL,
`variables` longtext NOT NULL,
`severity` tinyint(3) unsigned NOT NULL default '0',
`link` varchar(255) NOT NULL default '',
`location` text NOT NULL,
`referer` varchar(128) NOT NULL default '',