By editor, 3 January, 2017 Create a Drupal 9 Project using composer. Tags Drupal 8 Code Composer Using recommended-project template composer create-project drupal/recommended-project my-project For more information, see : https://www.drupal.org/docs/develop/using-composer/starting-a-site-using-drupal-composer-project-templates
By editor, 20 December, 2016 Drupal 8 Url Tips. Get Name, Path, Args ... Tags Drupal 8 Code Drupal 8 Url Object use Drupal\Core\Url; Create a Url Create Url from route name $url = Url::fromRoute('<current>'); $url = Url::fromRoute('entity.node.canonical', ['node' => 1], []);
By editor, 8 December, 2016 Adding jQuery UI Widget to drupal 8 Tags Drupal 8 Code jQuery Example : Step 1 : Add libraries. Example: (With theme / or module : mytheme) On : mytheme.libraries.yml file
By editor, 8 December, 2016 Create a configurable Block programmatically Tags Drupal 8 Code Here an example of configurable block.
By editor, 7 December, 2016 SimpleTest : Running PHPUnit tests from command line Tags Drupal 8 Code Debug Testing Initialisation - Create link to the script (Optional). ln -s core/scripts/run-tests.sh ~/bin Run Test and open rest in web browser. php core/scripts/run-tests.sh --browser --class "Drupal\YOUR_MODULE\Tests\JustTest"
By editor, 28 November, 2016 Add a Form in to a Basic Controller Tags Drupal 8 Code Form Drupal 9 NOTE: I don't know this is the best practice, anyway it's working !!!.
By editor, 22 November, 2016 Handle database schemas on Drupal 8 Tags Drupal 8 Code Database Get Database Schema $schema = \Drupal\Core\Database\Database::getConnection()->schema();
By editor, 12 November, 2016 Custom Content Entity Field types of drupal 8 Tags Drupal 8 Code Entity Database Entity Field types, Data types (BaseFieldDefinition::create types)
By editor, 30 October, 2016 Theme Negotiators - Switch theme dynamically Tags Drupal 8 Code Theming Create a custom module (here : example) For active themes by route you first have to define a service in your $module.services.yml file: On example.services.yml Add:
By editor, 25 October, 2016 Drupal 8 Cache API Tags Drupal 8 Code Cache Get the default cache bin $cache = \Drupal::cache(); To get a particular cache bin (here 'render'): $render_cache = \Drupal::cache('render');