Skip to content

Instantly share code, notes, and snippets.

View lcube45's full-sized avatar
🏌️‍♂️
Focusing

lcube lcube45

🏌️‍♂️
Focusing
View GitHub Profile
@lcube45
lcube45 / gist:707670a4d31c571d19db1444a6827374
Created June 1, 2020 14:52
Drupa 8 - find base form id
<?php
$form_state->getBuildInfo()['base_form_id'];
@lcube45
lcube45 / AjaxForm.php
Created June 1, 2020 14:51
Drupal 8 - ajax callback & alter form
<?php
class SimpleForm extends FormBase {
/**
* {@inheritdoc}
*/
public function getFormId() {
return 'simple_form';
}
@lcube45
lcube45 / AjaxForm.php
Created June 1, 2020 14:48
Drupal 8 - ajax callback
<?php
class AjaxForm extends FormBase {
/**
* {@inheritdoc}
*/
public function getFormId() {
return 'ajax_form';
}
@lcube45
lcube45 / gist:2c35ff4681dcba14fd00f0a7bcab838e
Created June 1, 2020 14:47
Drupal 8 - modèle physique de données pour les entités
Drupal 8:
----------
- Content type = Bundle
- Node = Entity
- Base fields are in one table: [entity]_field_data
- Bundle fields are in seperate tables: [entity]__field_name
@lcube45
lcube45 / gist:38e28ad3c7f341ca7c5c52cb19260abc
Created June 1, 2020 14:46
Drupal 8 - vider des caches spécifiques
// vider les caches spécifiques
$ drush cc drush
$ drush cc theme-registry
$ drush cc router
$ drush cc css-js
$ drush cc module-list
$ drush cc theme-list
$ drush cc render
$ drush cc token
$ drush cc views
;lsof -nP -i4TCP:9000 | grep LISTEN
;xdebug.remote_log=/fullpath/xdebug.log
opcache.enable=1
xdebug.coverage_enable=off
xdebug.extended_info=off
xdebug.remote_enable=1
xdebug.remote_port=9000
xdebug.remote_host=127.0.0.1
@lcube45
lcube45 / Blocks.md
Created January 13, 2020 15:36 — forked from bdlangton/Blocks.md
Drupal 8 programmatic solutions

Render custom blocks

$bid = 'myblock';
$block = \Drupal\block_content\Entity\BlockContent::load($bid);
$render = \Drupal::entityTypeManager()->getViewBuilder('block_content')->view($block);

Render plugin blocks

$block_manager = \Drupal::service('plugin.manager.block');
@lcube45
lcube45 / docker-compose.yml
Created January 18, 2019 13:13
tuleap docker compose
version: "2.1"
services:
tuleap:
image: enalean/tuleap-aio
restart: unless-stopped
environment:
VIRTUAL_HOST: "${VIRTUAL_HOST:-localhost}"
DB_HOST: "db"
MYSQL_ROOT_PASSWORD: "tuleap"
@lcube45
lcube45 / docker-compose.yml
Created January 18, 2019 13:12
phabricator docker compose
version: '2'
services:
mariadb:
image: 'bitnami/mariadb:latest'
environment:
- ALLOW_EMPTY_PASSWORD=yes
volumes:
- 'mariadb_data:/bitnami'
phabricator:
image: 'bitnami/phabricator:latest'
@lcube45
lcube45 / docker-compose.yml
Created January 18, 2019 13:11
gitlab docker compose
web:
image: 'gitlab/gitlab-ce:latest'
restart: always
hostname: 'gitlab.example.com'
environment:
GITLAB_OMNIBUS_CONFIG: |
external_url 'https://gitlab.example.com'
# Add any other gitlab.rb configuration here, each on its own line
ports:
- '80:80'