- Propulsé par
- WordPress
-
[Drupal] Change CKEditor behaviour for line breaks (br or p)
Here is a little code snippet to be added in a .module file. /** * Implements hook_editor_js_settings_alter(). * * {@inheritdoc} */ function MODULE_editor_js_settings_alter(array &$settings) { foreach ($settings[‘editor’][‘formats’] as $name => $value) { // Use instead of on enter. // See: https://docs.ckeditor.com/ckeditor4/latest/api/CKEDITOR.html#property-ENTER_BR. // CKEditor natively converts double into on rendering. $settings[‘editor’][‘formats’][$name][‘editorSettings’][‘enterMode’] = ‘2’; } } Additional…
-
[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. /** * 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…
-
[Drupal] VM + XDebug + Netbeans
Hey! Long time no see! Heehee. I am just dropping a note here about the basic steps of how to install XDebug for a specific setup. Here is my configuration: host: OS: Windows 7 64 bits IP: 192.168.0.3 IDE: Netbeans 8.2 guest: OS: Debian Jessie 64 bits in VirtualBox IP: 192.168.0.4 (bridged network in VirtualBox…
-
[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
-
Replace image URLs in WordPress posts from http to https
I just switched my website to https for testing purpose. But changing the website’s URL to https:// is not sufficient to enable a fully secure browsing experience, as images in posts are still loaded from http://. Or more precisely, most modern browsers (FF or Opera for instance) are now clever enough to guess that the…
-
[Drupal] Base hook schema example to put in .install
Introduction Delighted hook_schema is one of those methods where you are happy to have a usable documentation on the api website. It is pretty much self-explanatory and you don’t have to look for hours on third parties websites to get some usable information. 🙂 hook_schema on api.drupal.org and don’t forget to select your Drupal version!…
-
[Drupal] Table render array example structure
Result The code public function controllerCallbackExample() { return [ ‘#type’ => ‘table’, ‘#caption’ => ‘This is a caption. Use a translated string here.’, ‘#header’ => [ ‘Header 1’, ‘Header 2’, ‘Header 3’, ‘Header 4’ ], ‘#rows’ => [ [ ‘Row 1 Cell 1’, ‘Row 1 Cell 2’, ‘Row 1 Cell 3’, [‘data’ => ‘Row 1…
-
[Drupal] Service dependency injection in a service type class
The code services: my_module.event_subscriber: # Your service class class: Drupal\my_module\Entity\EventSubscriber\MyModuleSubscriber # Add your services to load here in the array arguments: [‘@current_user’] tags: # For this example, I am making an event subscriber class – { name: event_subscriber }
-
[Drupal] Service dependency injection in a plugin type class
The code