# mod\_wires

Source: https://zotonic.com/docs/1303/mod_wires

URI: https://zotonic.com/id/1303

Language: en



Actions, tags (also known as screen components), and javascript for user interfaces using *wires*.

Used by <a href="/id/doc_module_mod_admin" class="doc-reference doc-reference-module"><code>module#mod_admin</code></a> and the other administrative modules.

Wires are actions that are directly coupled to user interface elements. These couplings are defined in the templates using the <a href="/id/doc_template_scomp_scomp_wire" class="doc-reference doc-reference-scomp"><code>scomp#wire</code></a> tag.

Automatic widget loading
------------------------

The widget manager initializes elements with a `do_<name>` class using the corresponding jQuery widget. If that widget is not registered yet, it tries to load `js/modules/z.<name>.js` from the enabled modules and site. For example, `do_autofocus` loads `js/modules/z.autofocus.js`. The `do_dialog` alias loads `z.dialog.js` and calls `show_dialog`.

Libraries use the normal timestamped lib URLs and share the browser asset registry with lib tags. Concurrent discoveries share a load. Initialization is asynchronous for missing widgets; existing widgets initialize as before. Widget defaults and `data-<name>` options are read after loading. Removed elements are not initialized. Missing files or libraries that do not register the expected jQuery function produce a browser console warning.

Set configuration module `mod_wires`, key `widget_autoload`, to `false` to disable this automatic loading (default: `true`). Already included widgets still work. Widgets with a different file layout, or additional dependencies, should be included explicitly with the lib tag. Configuration is checked by the server when resolving a missing widget; reload open pages after changing it.

The model path `model/wires/get/widget/<name>` returns the asset descriptors used by the loader. Names may contain letters, digits, underscores and hyphens.

Accepted Events
---------------

This module handles the following notifier callbacks:

- `observe_acl_is_allowed`: Allow publish from clients to the transport topic.
- `observe_output_html`: Render nested actions and scomp results using `z_render:output`.
- `observe_page_actions`: Sanitize and normalize page action payloads before they are sent to the browser.
- `observe_postback_notify`: Handle postback notifications for showing a media overlay.
- `observe_scomp_script_render`: Part of the \{% script %\} rendering in templates using `z_render:make_postback_info`.

Delegate callbacks:

- `event/2` with `postback` messages: `mediaoverlay_update`.

License: 

Attribution: 

Related resources: https://zotonic.com/api/agent/related/1303?language=en


## API access

- [API help](<https://zotonic.com/api-help>)
- [OpenAPI specification](<https://zotonic.com/openapi.json>)
- [This resource as JSON](<https://zotonic.com/api/agent/resource/1303?language=en>)
