By editor, 30 September, 2021 Translation API - PHP Twig JavaScript Tags Drupal 8 Drupal 9 Translation JavaScript Twig PHP PHP Class using StringTranslationTrait StringTranslationTrait allow to get t() and formatPlural() methods Example: use Drupal\Core\StringTranslation\StringTranslationTrait; use Drupal\Core\StringTranslation\TranslationInterface; class MyClass {
By editor, 26 November, 2020 Drupal 9 add inline JavaScript to a page programmatically Tags Drupal 8 Code JavaScript Method 1 : Form hook_page_attachments
By editor, 28 March, 2018 Increment or Decrement number of Fields Dynamically using Form API and Ajax Tags Drupal 8 Code Form JavaScript In this example, we will use a field to get tags list, the number of tags dynamic.
By editor, 13 February, 2018 JavaScript Events on Drupal 8. Tags Drupal 8 Code JavaScript Module Note : On drupal the best practice is use drupal behaviors but not JS or Jquery codes such as: <button onclick='myFunction()'>Click</button>
By editor, 23 January, 2018 JavaScript useful tips and examples Tags JavaScript Code Get HTTP Header information From JavaScript Note : It's not possible to read the current headers. You could make another request to the same URL and read its headers, but there is no guarantee that the headers are exactly equal to the current.
By editor, 6 June, 2017 Run JavaScript code via web browser console. Tags Drupal 8 Code JavaScript Features Note : Following examples are tested on FireFox Version 52. Open Web browser console. F12 Method 1 . Press F12 and click on "Console" Method 2 . Press Ctrl + Shift + K
By Anonymous (not verified), 14 June, 2016 HTML JS communication between iframes and Cross-document messaging Tags JavaScript Example : For example in the top window (Parent): (the_iframe.contentWindow.postMessage('data', 'domain');)
By editor, 8 June, 2016 Drupal Behaviors - JavaScript and jQuery Tags Drupal 8 Code JavaScript jQuery What is drupal behaviors ? Drupal behaviors allow to execute javascpts in particular context and / or pass data from drupal to client side java script.
By editor, 2 June, 2016 Run a JavaScript for selected pages (using body class) Tags Drupal 8 Drupal 7 JavaScript jQuery Example : Execute JS only in the front page. This Script run whin the body tag contains class='front'
By editor, 4 March, 2016 Theming tips for Bootstrap framework Tags Theming JavaScript CSS Modal dialogue box ( bootstrap / jquery) 1. Remobe the gray background of modal dialog box (modal-backdrop) .modal-backdrop { background-color: transparent; }