Here an example for create node programmatically in Drupal 8
Search content
You can't change the body of this block fron the user interface. But you can do that using a small custom module using hook_block_view_alter().
Filters list (Syntaw)
filter: none | blur() | brightness() | contrast() | drop-shadow() | grayscale() | hue-rotate() | invert() | opacity() | saturate() | sepia() | url();
Examples:
Convert block/image ... to black and white (Gray out):
Example : Execute JS only in the front page.
This Script run whin the body
tag contains class='front'
Drupal Console is the new CLI for Drupal. Drupal Console is a tool to generate boilerplate code, interact and debug Drupal. From the ground up, it has been built to utilize the same modern PHP practices which were introduced in Drupal 8.
Example 1. Basic inline template
$output[] = [
'#type' => 'inline_template',
'#template' => '{{ yourvar }}',
'#context' => [
This system allow you to invalidate drupal cache using a 'tag'
Exapples:
What is drupal behaviors ?
Drupal behaviors allow to execute javascpts in particular context and / or pass data from drupal to client side java script.
1 Ignore files And Folders using .gitignore
Files (Include and/or Exclude)
Create the gitignore file at the top of your repository,i f it's not already exist
Cache configuration of a renderer array (Just an exaple)
Select:
$con = \Drupal\Core\Database\Database::getConnection();
$query = $con->select('table_name', 't')
->fields('t', ['field_1', 'field_2']);
The .bashrc file is a script that is executed whenever a new terminal session is started in interactive mode. It is just the shortcut to the commands allows the user to launch any command or group of commands.
Example 1 : With DOMDocument: (Fast (0.0002 sec) but can have php warning)
Use drupal 8 httpClient to read URL.
// Drupal httpClient.
$http = \Drupal::httpClient();
$url = 'http://example.com/';
Example:
$options = array();
$result = $http->request('get', $url, $options);
Tuto English :
CSS Box Model : http://www.w3schools.com/css/css_boxmodel.asp
CSS display Property - http://www.w3schools.com/cssref/pr_class_display.asp
Option 1.
Use the drupal 8 native URL Field option.
Option 2. Module PathAuto
- Configure the path settings and Path pattern
-> NOTE : Do not change the path
Example :
For example in the top window (Parent): (the_iframe.contentWindow.postMessage('data', 'domain');
)
In drupal 8, this retrun taxonomy vocabularies as an array.
$vocabularies = \Drupal\taxonomy\Entity\Vocabulary::loadMultiple();
Word Wrap ( word-wrap )
Available values of word-wrap property: normal, break-word, initial, inherit
Example : Disable HTML word wrapping using CSS
.your-class{white-space:nowrap;}
Compilers
1. COMPASS
Compass is a powerfull command line compiler
Install (Linux debian) : sudo apt-get install ruby-compass
Link : http://compass-style.org/help/documentation/command-line/
2. Koala
1. Stop the MySQL service of started
sudo /etc/init.d/mysql stop
#On Debian based linux systems (Ubuntu, Mint ...)
sudo /etc/init.d/mysqld stop
#On Red Hat Enterprise based Linux systems (CentOS, Fedora, Suse ...)
1. Access control by IP : (Example)
order deny,allow
deny from all
allow from [YOUR_IP_ADDRESS]
The database settings (and connection) has 3 levels.
1. KEY
2. TARGET
3. DATA
Example:
$databases[KEY][TARGET] = array (
DATA
);
Like:
Example :
<style>
#parent-div { display: flex; }
#el1 { order: 3; }
#el2 { order: 2; }
#el3 { order: 1; }
</style>