drupal console in project drupal 8


Install console drupal

Download console drupal

Terminal:
curl https://drupalconsole.com/installer -L -o drupal.phar

Move console to directory bin 
Terminal:
sudo mv drupal.phar /usr/local/bin/drupal

Assign execution permissions
Terminal:
chmod +x /usr/local/bin/drupal

Change to directory your drupal 8
Terminal:
cd ~/yourDirectory/drupal8/

it is necesary, install for compose the console drupal 8
Terminal:
composer require drupal/console:~1.0 --prefer-dist --optimize-autoloader

Generate a new module
Terminal:
drupal generate:module


Generate Block element of module create before (here you can specif the field to use in the block)

Terminal:
drupal generate:plugin:block



in drupal install module and after go to structure -> block -> add block | search you block create before





after you add content for each field, save and ready you can a block of your module


0 comentarios :