A sample script which can create a one column layout and store body field in it. namespace Drupal\custommodule\Controller; use Drupal\Core\Controller\ControllerBase; use Drupal\layout_builder\Section; use Drupal\layout_builder\SectionComponent; use Drupal\node\Entity\Node; use Drupal\block\Entity\Block; use Drupal\block_content\Entity\BlockContent; use Drupal\layout_builder\Entity; $entity = Node::load(10); $section = new Section('layout_onecol'); $uuid = $entity->uuid(); $region = 'content'; $pluginConfiguration = [ 'id' => 'field_block:node:article:body', 'provider' => 'layout_builder', 'label_display' => FALSE, 'view_mode' => 'default', 'entity' => $entity->id(), 'context_mapping' => [ ...
For better understanding: https://docs.acquia.com/article/tools-analyzing-your-drupal-codebase Following artcle my experience with Sonar and Drupal. https://docs.sonarqube.org/display/PLUG/SonarPHP has following number of rules. Sonarway (for PHP) has following number of rules 1. Bug:15 2. Vulnerability:3 3. Code smell:45 Drupal has following number of rules 1. Bug: 3 2. Vulnerability: 0 3. Code smell: 10 Its possible that you can define following inheritance in Quality profile. For example: Sonarway=>Drupal Drupal uses PHPCodeSniffer (Drupal standards) or Coder to verify its coding standards. Both of them dont have integration with Sonar. 3. Sonar comes up with some Drupal Coding Standards. But is is not same as what we do in PHPCodeSniffer and Coder. 4. It's still better to fix critical / blocker issues from Sonar Way and Drupal Quality profiles. Its best to use PHPCodeSniffer with Drupal standards and some repor...
php bin/console list php bin/console generate:controller Symfony console: What we are going to do? 1. Install symfony at http://127.0.0.1:8001 2. Create a controller at http://127.0.0.1:8001/products 3. Create a controller at http://127.0.0.1:8001/product Installing symfony: 1. apache-doc-root> composer create-project symfony/framework-standard-edition autotrader2 2. autotrader2> php bin/console server:run It should show like [OK] Server listening on http://127.0.0.1:8001 3. Run in browser http://127.0.0.1:8001 It should say Welcome to Symfony 3.4.4 Create a controller at http://127.0.0.1:8001/products Generate bundle: 1. autotrader2> php bin/console generate:bundle Note: a) Give bundle name as ProductBundle b) If following error occurs Checking that the bundle is autoloaded FAILED then add "ProductBundle\\": "src/ProductBundle" in composer.json . So it should look like this "psr-4": { ...
Comments
Post a Comment