The road to custom scrollbars Reminiscing. I am currently working on a website for a video game reviews project I have had with an old friend of mine (FuuDoh). Obviously, I have switched to Drupal to get a result quicker than what I would get with the PHP only solution I have been working on […]
Tag Archives: thème
[Drupal] Make the Search API Page search block appear in Bootstrap markup
When using Search API Page, I needed to theme the search form in the bootstrap structure. The cleanest answer I have found is to add some variables to trigger the bootstrap overrides on the search form.
1 2 3 4 5 6 7 8 9 |
/** * Implements hook_form_FORM_ID_alter(). */ function MYMODULE_form_search_api_page_block_form_alter(&$form, FormStateInterface $form_state, $form_id) { // We need this to make our search_api_page_block_form rendered in the bootstrap fashion // This code was inspired by \Drupal\bootstrap\Plugin\Form\SearchBlockForm $form['actions']['submit']['#icon_only'] = true; $form['keys']['#input_group_button'] = true; } |
Additional Information Instructions made on Drupal 8.3.x (probably, haha).
[Drupal] Use admin_block and admin_block_content templates
This article is about the default admin_page, admin_block and admin_block_content templates which serves as the base of the content display on some system configuration pages such as the one on this image: The code
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 |
<?php namespace Drupal\your_module\Controller; use Drupal; use Drupal\Core\Controller\ControllerBase; use Drupal\Core\Url; class YourModuleController extends ControllerBase { protected $database; function content() { // Render array to return $mainRenderArray = []; // admin_page style (half width) $mainRenderArray[] = [ '#theme' => 'admin_page', '#blocks' => [ // Array of admin_block [ 'title' => $this->t('A block, on the left'), 'position' => 'left', 'content' => [ '#theme' => 'admin_block_content', '#content' => [ [ 'title' => 'Do something', 'url' => Url::fromRoute('your_module.some.example.route'), 'description' => $this->t('This will link to a route.') ], [ 'title' => 'Navigate to a nice blog', 'url' => Url::fromUri('https://blog.dakwamine.fr'), 'description' => $this->t('This will link to a URI, external in this case.') ], [ 'title' => 'Go to contents page', 'url' => Url::fromUri('internal:/admin/content'), 'description' => $this->t('Also works for internal URI.') ] ] ] ], [ 'title' => $this->t('Another block, on the right'), 'position' => 'right', 'content' => [ '#theme' => 'admin_block_content', '#content' => [ [ 'title' => 'Another link to a route', 'url' => Url::fromRoute('your_module.another.route'), 'description' => $this->t('Yup.') ], [ 'title' => 'Website example link', 'url' => Url::fromUri('https://website.example'), 'description' => $this->t('Goes on website.example.') ], ] ] ] ], ]; // admin_block style (full width) $mainRenderArray[] = [ '#theme' => 'admin_block', '#block' => [ 'title' => $this->t('Full width block'), 'content' => [ '#theme' => 'admin_block_content', '#content' => [ [ 'title' => 'Another link', 'url' => Url::fromUri('internal:/admin/people'), 'description' => $this->t('A link to the people page.') ], [ 'title' => 'Another link again', 'url' => Url::fromUri('https://website.example'), 'description' => $this->t('Goes on website.example.') ], ] ], ], ]; return $mainRenderArray; } } |
Explanation If you use admin_page, you will be able to define the column in which the blocks dwell: left or […]
Remise à zéro du thème
J’ai remis le thème par défaut suite à la mise à jour de WordPress. Il y a un grand nombre de nouveautés et l’ancien thème ne les prenait pas en compte de manière subtile. Je n’ai pas encore décidé si je voulais changer de thème, celui-là semblant fonctionner convenablement (et heureusement). Je vais peut-être apporter […]