Breakdance & Oxygen Compatibility
Oxygen and Breakdance share most of their core builder engine, so an extension written for
one can usually work for both with minimal changes. What differs is the hook names, the
strings and how an element declares itself.
Every shared hook has two names
Most of the shared code fires each hook twice: once under its breakdance_ name and
once under an oxygen_ name, with the same arguments.
// Both of these work on an Oxygen site, and both receive the same value.
add_filter('oxygen_shape_dividers', 'my_dividers');
add_filter('breakdance_shape_dividers', 'my_dividers');
In a plugin that must support both products, hook the breakdance_ name. It is the name
that fires on both. The oxygen_ name exists only on Oxygen, so a callback attached to it
never runs under Breakdance.
The oxygen_ copy always runs second. The breakdance_ name fires first with every one
of its callbacks, and only then does the oxygen_ name fire, with the result. So if
something hooks both, the oxygen_ callback sees what the breakdance_ callback returned
and wins any conflict — regardless of the priorities set.
Detecting which product you're on
The BREAKDANCE_MODE constant is 'oxygen' or 'breakdance', and it's defined before any
plugin code runs:
if (BREAKDANCE_MODE === 'oxygen') {
// Oxygen-specific behaviour
}
Use it for anything user-facing — labels, docs links, admin notices. Don't use it to pick a
hook name; the breakdance_ name is correct on both.
Elements that ship to both
An element declares the products it appears in with availableIn(), in the element's own
element.php:
static function availableIn()
{
return ['breakdance', 'oxygen'];
}
You don't have to write it by hand. Element Studio's Settings tab has an Available In
multi-select that writes this for you — see
Element Studio settings. Return both to ship one
element to both products; return just one to keep it out of the other.
PHP namespaces are Breakdance… on both products — those never change with the mode, and
neither do the element base classes or the control helpers.