You are here

Example: JavaScript in Examples for Developers 8

Same name and namespace in other branches
  1. 7 js_example/js_example.module \js_example
  2. 3.x modules/js_example/js_example.module \js_example

Examples using Drupal 8's built-in JavaScript.

We have two examples here.

One 'weights' content and then sorts it by weight. This demonstrates attaching JavaScript through Drupal's render arrays.

The other demonstrates adding an accordion effect to content, through Drupal's theme layer.

Parent topics

File

js_example/js_example.module, line 8
Examples showing how to use some of the new JavaScript features in Drupal 8.

Functions

Namesort descending Location Description
js_example_theme js_example/js_example.module Implements hook_theme().

Classes

Namesort descending Location Description
JsExampleTest js_example/tests/src/Functional/JsExampleTest.php Functional tests for the js_example module.