By admin, 29 May, 2023 Create tabs in admin configuration page Create mymodule.links.task.yml and add some lines Tags tabs
By admin, 21 May, 2023 Get all content entities $content_entity_types = []; $entity_type_definations = \Drupal::entityTypeManager()->getDefinitions(); /* @var $definition EntityTypeInterface */ foreach ($entity_type_definations as $definition) { if ($definition instanceof ContentEntityType) { $content_entity_types[] = $definition; } } Tags entity custom entity
By admin, 20 May, 2023 Form API collapsible fieldset $form['advanced'] = array( '#type' => 'details', '#title' => t('Advanced settings'), '#description' => t('Lorem ipsum.'), '#open' => TRUE, // Controls the HTML5 'open' attribute. Tags fieldset form
By admin, 19 May, 2023 Add permission to role $role_object = Role::load('authenticated'); if ($role_object) { $role_object->grantPermission('mymodule write messages'); $role_object->save(); } Tags roles permissions
By admin, 15 May, 2023 Remove user field programmatically use Drupal\field\Entity\FieldStorageConfig; use Drupal\field\Entity\FieldConfig; /** * Implements hook_uninstall(). */ function Tags field
By admin, 10 May, 2023 Slick slider: margin between slides .slick-list { margin: 0 -24px; } .slick__slide { margin: 0 24px; } Tags slick
By admin, 8 May, 2023 Render form in block <?php namespace Drupal\mymodule\Plugin\Block; use Drupal\Core\Block\BlockBase; use Drupal\Co Tags form block
By admin, 4 May, 2023 Inject RouteMatchInterface to ContentEntityForm use Drupal\Core\Routing\RouteMatchInterface; /** * The current route match. * * @var \Drupal\Core\Routing\RouteMatchInterface */ protected $routeMatch; /** * Constructs a PrivatemsgMessageForm object. * * @param \Drupal\Core\En Tags dependency injection routes
By admin, 3 May, 2023 Inject Logger to service use Drupal\Core\Logger\LoggerChannelFactoryInterface; /** * Logger Factory. * * @var \Drupal\Core\Logger\LoggerChannelFactoryInterface */ protected $logger; /** * Constructor. */ public Tags dependency injection logger