Render arrays
Example:
$con = Drupal\Core\Database\Database::getConnection();
$start_value = 100000;
$query = "ALTER TABLE {the_table} AUTO_INCREMENT = $start_value";
$con->query($query);
Example : Display user login form on a page
Example : (Insert this line in to your form submitForm()
methode)
Redirect to the user page ( Redirection on form submit)
$form_state->setRedirect('user.page');
Step 1.
Check apache error log (use tail to show in real time)
# tail -f /var/log/apache2/error.log
Step 2 :
Check MySQL database connection using mysql -uusername -ppassword
Site Name:
$site_name = \Drupal::config('system.site')->get('name');
Site Address (Host)
$site_addr = "http://" . \Drupal::request()->getHost();
Step 1. Install Xdebug
If not already ainstalled, Install Xdebug (I'ts already on the package WAML, LAMP, MAMP)
In Linux Debian/Ubuntu/Mint
# sudo apt-get install php5-xdebug
Comments are set as a field, so by default it is not present. To add comment field Goto:
Admin -> Structure -> Content types ->"YOUR CONTENT"
->Manage fields->Add field
->Select 'Comments' on 'Re-use an existing field' and Save.
Step 1. Connect to the server as root or execute commands as sudo
#sudo su
Step 2. remove all log files
rm -rf /var/log/apache2/*
rm -rf /var/log/virtualmin/*
....
Example:
Example 1. Ignore (Exclude) a simple file or a folder
sites/default/settings.php
sites/*/files
Syatax (Usually used)
mysqldump --host=IP-OR-HOST --user=USERNAME --password=PASSWORD database_name > database_name.sql
mysqldump -h IP-OR-HOST -u USERNAME -pPASSWORD database_name > database_name.sql
Step 1. Switch to your branch
Strp 2. Remove files using -rm command
Ex : git rm -r sites/all/modules/stage_file_proxy
Step 3. Add this file to the .gitignore
vertical-align: middle;
is working in a TABLE, but not inside if a DIV
To move a background image (50px s=X 50px) to center of the previus line(50px to top).
1. Text-Align: Center;
div{
text-align: center;
}
2. Margin: 0 auto;
.main-container {
&:before {
content: ''; position: absolute; height: 500px; background: red; width: 100%; left: 0;
} }
ALSO:
Add z-index: -1; if this hide some thing
.main-container is a div just after the body
Create Patch:
git diff PATH/TO/SOURCE.php > PATH/SAVE_patch.diff
Apply patch
git apply PATH/SAVE_patch.diff
#Download / Get git repository
git clone http://url-of-your-git/project.git
#Show remore url
git remote -v
.modal-backdrop {
background-color: transparent;
}
.modal-backdrop {
background-color: transparent;
}
2. Modal dialog box Theming
Print : {{ variable_to_print }}
Code : {% codes %}
Comment : {# Comments #}
Example :
# Add a new CSS file:
stylesheets:
all:
- layout.css