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
10225 gco develop | |
10226 git fetch --all | |
10227 git pull | |
10228 git branch -D feature/DevOps-Refonte-du-docker | |
10229 git fetch --all | |
10230 gco feature/DevOps-Refonte-du-docker | |
10232 git branch | |
10234 git rebase origin/develop | |
10236 git add composer.lock | |
10238 git rebase --continue |
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
We are going to use composer to create a codebase with the latest version of Drupal 8 or 7: | |
Drupal 8: | |
composer create-project drupal-composer/drupal-project:8.x-dev docker_drupal --stability dev --no-interaction | |
Drupal 7: | |
composer create-project drupal-composer/drupal-project:7.x-dev docker_drupal --no-interaction | |
Then we are going to clone the latest version of docker4drupal and remove the .git folder from it: | |
git clone [email protected]:wodby/docker4drupal.git docker_drupal_server |
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
get current user in drupal 8 | |
Description: In drupal 7 we get the current user object by defining global $user but in drupal 8 this quite different. If you want to get current user object then follow below code. | |
$current_user = \Drupal::currentUser(); | |
$uid = $current_user->id(); | |
It returns user id of current user. | |
$user_mail = $current_user->getEmail(); | |
It returns user email 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
// Logs a notice | |
\Drupal::logger('my_module')->notice($message); | |
// Logs an error | |
\Drupal::logger('my_module')->error($message); | |
// Logs an info | |
\Drupal::logger('my_module')->info($message); |
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
List all containers (only IDs): | |
docker ps -aq | |
Stop all running containers: | |
docker stop $(docker ps -aq) | |
Or this one: | |
docker-compose down --remove-orphans | |
Or this one: |
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
{% form_theme form _self %} | |
{% block checkbox_widget -%} | |
{%- set parent_label_class = parent_label_class|default(label_attr.class|default('')) -%} | |
{%- if 'checkbox-custom' in parent_label_class -%} | |
{%- set attr = attr|merge({class: (attr.class|default('') ~ ' custom-control-input')|trim}) -%} | |
<div class="custom-control custom-checkbox{{ 'checkbox-inline' in parent_label_class ? ' custom-control-inline' }}"> | |
{{ block('checkbox_widget_base') }} | |
</div> | |
{%- else -%} |
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 | |
$mime = \Drupal::service('file.mime_type.guesser')->guess($uri); |
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
# Created by .ignore support plugin (hsz.mobi) | |
### Python template | |
# Byte-compiled / optimized / DLL files | |
__pycache__/ | |
*.py[cod] | |
*$py.class | |
# C extensions | |
*.so |
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 | |
// Autoload Url and Link classes. | |
use Drupal\Core\Url; | |
use Drupal\Core\Link; | |
/** | |
* External link | |
*/ | |
$url = Url::fromUri('https://colorfield.be'); |
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 | |
// Delete all nodes. | |
entity_delete_multiple('node', \Drupal::entityQuery('node')->execute()); | |
// Delete all files. | |
entity_delete_multiple('file', \Drupal::entityQuery('file')->execute()); | |
// Delete all taxonomy terms. | |
entity_delete_multiple('taxonomy_term', \Drupal::entityQuery('taxonomy_term')->execute()); |
NewerOlder