This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
wget https://ftp.drupal.org/files/projects/drupal-8.5.6.tar.gz | |
tar -zxf drupal-*.tar.gz | |
chmod -R 777 drupal-8.5.6 | |
rm -r drupal-8.5.6.tar.gz | |
mv /home/radhe/Desktop/drupal-8.5.6 /home/radhe/Desktop/d8 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function dots_views_data() { | |
// Group Dots Table | |
$data['dots_table']['table']['group'] = t('Dots Table'); | |
$data['dots_table']['table']['base'] = array( | |
'field' => 'nid', | |
'title' => t('Dots Table'), | |
'help' => t('Example table contains example content and can be related to nodes.'), | |
'weight' => -10, | |
); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
use Drupal\Core\Database\Database; | |
/** | |
* Implements hook_schema(). | |
*/ | |
function dots_schema() { | |
$schema['dots_table'] = [ | |
'description' => 'dots table', | |
'fields' => [ | |
'id' => [ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
$output = ''; | |
$view = views_get_view('assets_search'); | |
if($view){ | |
$view->set_display('page'); | |
$output = $view->preview('assets_search'); | |
print $output; | |
} | |
?> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Create block type | |
Field - Title, body, image, link, | |
help - https://medium.com/@sarahcodes/custom-block-type-for-hero-banners-in-drupal-8-7d0adb665fd3 | |
Twig Field value - https://blog.usejournal.com/getting-drupal-8-field-values-in-twig-22b80cb609bd | |
**************************************************** | |
1. themename.theme | |
/** | |
* Implements hook_theme_suggestions_HOOK_alter() for form templates. | |
*/ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function common_mail_alter(&$message) { | |
if ($message['id'] == 'user_password_reset') { | |
$message['headers']['Content-Type'] = 'text/html; charset=UTF-8; format=flowed; delsp=yes'; | |
} | |
} | |
/* Password recovery */ | |
<a href='[user:one-time-login-url]' target="_blank">Generate/Reset Password</a> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Implements hook_cron(). | |
*/ | |
function csv_uploader_cron() { | |
$end_date = strtotime(date('Y-m-d H:i:s')); | |
$start_date = strtotime(date('Y-m-d H:i:s', strtotime("-2 days"))); | |
$query = \Drupal::database()->select('node_field_data','n'); | |
$query->leftjoin('node__field_roles','r', 'n.nid=r.entity_id'); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Create a new administrator account in drupal with drush | |
Create your new user: | |
$ drush user-create your_user_name --mail="[email protected]" --password="your user password" | |
Assign the role administrator to your user: | |
$ drush user-add-role "administrator" your_user_name |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
\Drupal::logger('debugging2')->warning(print_r($item, TRUE)); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Settings.php | |
$settings['hello_world'] = 'Radheshyam Kumar Kumawat'; | |
//bartik.theme | |
function bartik_preprocess_page(&$variables) { | |
$variables['setting_name_value'] = Settings::get('hello_world', 'my drupal setting name'); | |
} | |
//page.html.twig | |
{{ setting_name_value }} |