Customer Site Shell Hooks

1 views Markdown

The sixteen placement points shared by every page: the head, the body, menus and the footer.

Overview

The placement points present on every page of the site live here: the head section, the body, the menus, the footer and the system pages.

What they share is scale: what you place here runs on the home page, at the payment step and on an error page alike. Weigh the cost at that scale.

Reference

Adding a style to the site

uiclient.head.css
website/inc no parameters

Appears in the head section of the site, on every page. Link a stylesheet of your own here.

Parameters 0
It takes no parameters.
Return 1
string|nullThe HTML you return appears. With several listeners the outputs are appended one after another in priority order. Empty text, null and false are skipped, so return null when you have nothing to add. The output enters the page unescaped — clean anything coming from outside yourself.
Listener
Hook::add('ui:client.head.css', 10, function () {
    return '<div class="alert alert-info">Acme</div>';
});

Adding a script to the site

uiclient.head.js
website/inc no parameters

The place to add a script on every page. It is the first thing a visitor meets: a heavy file delays the page opening.

Parameters 0
It takes no parameters.
Return 1
string|nullThe HTML you return appears. With several listeners the outputs are appended one after another in priority order. Empty text, null and false are skipped, so return null when you have nothing to add. The output enters the page unescaped — clean anything coming from outside yourself.
Listener
Hook::add('ui:client.head.js', 10, function () {
    return '<div class="alert alert-info">Acme</div>';
});

The start of the body

uiclient.body.begin
website/inc no parameters

Appears at the very start of the page body. It suits an announcement banner across the site.

Parameters 0
It takes no parameters.
Return 1
string|nullThe HTML you return appears. With several listeners the outputs are appended one after another in priority order. Empty text, null and false are skipped, so return null when you have nothing to add. The output enters the page unescaped — clean anything coming from outside yourself.
Listener
Hook::add('ui:client.body.begin', 10, function () {
    return '<div class="alert alert-info">Acme</div>';
});

The end of the body

uiclient.body.end
website/inc no parameters

Appears at the very end of the page body. The right place for modals and tracking scripts.

Parameters 0
It takes no parameters.
Return 1
string|nullThe HTML you return appears. With several listeners the outputs are appended one after another in priority order. Empty text, null and false are skipped, so return null when you have nothing to add. The output enters the page unescaped — clean anything coming from outside yourself.
Listener
Hook::add('ui:client.body.end', 10, function () {
    return '<div class="alert alert-info">Acme</div>';
});

The end of the top bar

uiclient.topbar.end
website/inc no parameters

Appears at the end of the top bar.

Parameters 0
It takes no parameters.
Return 1
string|nullThe HTML you return appears. With several listeners the outputs are appended one after another in priority order. Empty text, null and false are skipped, so return null when you have nothing to add. The output enters the page unescaped — clean anything coming from outside yourself.
Listener
Hook::add('ui:client.topbar.end', 10, function () {
    return '<div class="alert alert-info">Acme</div>';
});

The header action area

uiclient.header.actions
website/inc no parameters

Appears in the action area of the site header.

Parameters 0
It takes no parameters.
Return 1
string|nullThe HTML you return appears. With several listeners the outputs are appended one after another in priority order. Empty text, null and false are skipped, so return null when you have nothing to add. The output enters the page unescaped — clean anything coming from outside yourself.
Listener
Hook::add('ui:client.header.actions', 10, function () {
    return '<div class="alert alert-info">Acme</div>';
});

The main menu items

uiclient.nav.items
website/inc no parameters

Appears among the items of the main menu. Use the same item markup so the menu structure holds.

Parameters 0
It takes no parameters.
Return 1
string|nullThe HTML you return appears. With several listeners the outputs are appended one after another in priority order. Empty text, null and false are skipped, so return null when you have nothing to add. The output enters the page unescaped — clean anything coming from outside yourself.
Listener
Hook::add('ui:client.nav.items', 10, function () {
    return '<div class="alert alert-info">Acme</div>';
});

The sub-menu items

uiclient.subnav.items
website/inc no parameters

Appears among the items of the sub-menu.

Parameters 0
It takes no parameters.
Return 1
string|nullThe HTML you return appears. With several listeners the outputs are appended one after another in priority order. Empty text, null and false are skipped, so return null when you have nothing to add. The output enters the page unescaped — clean anything coming from outside yourself.
Listener
Hook::add('ui:client.subnav.items', 10, function () {
    return '<div class="alert alert-info">Acme</div>';
});

The user menu items

uiclient.user_menu.items
website/inc no parameters

Appears in the menu of a signed-in user.

Parameters 0
It takes no parameters.
Return 1
string|nullThe HTML you return appears. With several listeners the outputs are appended one after another in priority order. Empty text, null and false are skipped, so return null when you have nothing to add. The output enters the page unescaped — clean anything coming from outside yourself.
Listener
Hook::add('ui:client.user_menu.items', 10, function () {
    return '<div class="alert alert-info">Acme</div>';
});

The drawer items

uiclient.drawer.items
website/inc no parameters

Appears among the items of the mobile drawer. It is separate from the main menu: add to both if you want it in both places.

Parameters 0
It takes no parameters.
Return 1
string|nullThe HTML you return appears. With several listeners the outputs are appended one after another in priority order. Empty text, null and false are skipped, so return null when you have nothing to add. The output enters the page unescaped — clean anything coming from outside yourself.
Listener
Hook::add('ui:client.drawer.items', 10, function () {
    return '<div class="alert alert-info">Acme</div>';
});

Above the footer

uiclient.footer.before
website/inc no parameters

Appears immediately above the footer.

Parameters 0
It takes no parameters.
Return 1
string|nullThe HTML you return appears. With several listeners the outputs are appended one after another in priority order. Empty text, null and false are skipped, so return null when you have nothing to add. The output enters the page unescaped — clean anything coming from outside yourself.
Listener
Hook::add('ui:client.footer.before', 10, function () {
    return '<div class="alert alert-info">Acme</div>';
});

The footer columns

uiclient.footer.columns
website/inc no parameters

Appears among the footer columns.

Parameters 0
It takes no parameters.
Return 1
string|nullThe HTML you return appears. With several listeners the outputs are appended one after another in priority order. Empty text, null and false are skipped, so return null when you have nothing to add. The output enters the page unescaped — clean anything coming from outside yourself.
Listener
Hook::add('ui:client.footer.columns', 10, function () {
    return '<div class="alert alert-info">Acme</div>';
});

The bottom of the footer

uiclient.footer.bottom
website/inc no parameters

Appears at the very bottom of the footer.

Parameters 0
It takes no parameters.
Return 1
string|nullThe HTML you return appears. With several listeners the outputs are appended one after another in priority order. Empty text, null and false are skipped, so return null when you have nothing to add. The output enters the page unescaped — clean anything coming from outside yourself.
Listener
Hook::add('ui:client.footer.bottom', 10, function () {
    return '<div class="alert alert-info">Acme</div>';
});

Above the call-to-action band

uiclient.cta_band.before
website/inc no parameters

Appears above the call-to-action band at the foot of the page.

Parameters 0
It takes no parameters.
Return 1
string|nullThe HTML you return appears. With several listeners the outputs are appended one after another in priority order. Empty text, null and false are skipped, so return null when you have nothing to add. The output enters the page unescaped — clean anything coming from outside yourself.
Listener
Hook::add('ui:client.cta_band.before', 10, function () {
    return '<div class="alert alert-info">Acme</div>';
});

The maintenance page body

uiclient.maintenance.body
website/inc no parameters

Appears in the body of the maintenance page. It runs while the site is closed: a listener reaching the database or an outside service here can take down the page at an already bad moment.

Parameters 0
It takes no parameters.
Return 1
string|nullThe HTML you return appears. With several listeners the outputs are appended one after another in priority order. Empty text, null and false are skipped, so return null when you have nothing to add. The output enters the page unescaped — clean anything coming from outside yourself.
Listener
Hook::add('ui:client.maintenance.body', 10, function () {
    return '<div class="alert alert-info">Acme</div>';
});

The system page head

uiclient.system_page.head
website/inc no parameters

Appears in the head of the error and blocked pages. Those pages are shown even when the core has failed: give simple output with no dependencies.

Parameters 0
It takes no parameters.
Return 1
string|nullThe HTML you return appears. With several listeners the outputs are appended one after another in priority order. Empty text, null and false are skipped, so return null when you have nothing to add. The output enters the page unescaped — clean anything coming from outside yourself.
Listener
Hook::add('ui:client.system_page.head', 10, function () {
    return '<div class="alert alert-info">Acme</div>';
});

Pitfalls

Shell points run at the payment step too

The head and body points run on every page of the site, the basket and the payment step included. A slow script there delays not one page but the purchase path itself.

Build no dependencies on the maintenance and error pages

The maintenance and system page points run at the moment the site is already in trouble. A listener reaching for the database or an outside service there takes down the last page the user would have seen. Give simple output with no dependencies.

Was this helpful?

Thanks for your feedback!

Still Need Help?

Our support team is here around the clock for anything you can't find above.