$bid = 'myblock';
$block = \Drupal\block_content\Entity\BlockContent::load($bid);
$render = \Drupal::entityTypeManager()->getViewBuilder('block_content')->view($block);
$block_manager = \Drupal::service('plugin.manager.block');
| ;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 |
| // 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 |
| 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 |
| <?php | |
| class AjaxForm extends FormBase { | |
| /** | |
| * {@inheritdoc} | |
| */ | |
| public function getFormId() { | |
| return 'ajax_form'; | |
| } |
| <?php | |
| class SimpleForm extends FormBase { | |
| /** | |
| * {@inheritdoc} | |
| */ | |
| public function getFormId() { | |
| return 'simple_form'; | |
| } |
| <?php | |
| $form_state->getBuildInfo()['base_form_id']; |
| # https://www.drupal.org/node/2487215 | |
| drush sql-query "DELETE FROM key_value WHERE collection='system.schema' AND name='module_name';" |
| Specifying a version you can specify a version from the command line with: | |
| composer require drupal/<modulename>:<version> | |
| For example: | |
| composer require drupal/ctools:3.0.0-alpha26 | |
| composer require drupal/token:1.x-dev |
| <?php | |
| namespace Drupal\mon_module\Tools | |
| use Drupal\taxonomy\Entity\Term; | |
| /** | |
| * Service de récupération d'arborescence de termes | |
| * | |
| * @package Drupal\mon_module\Tools |