Control contributing markup using a dynamic content spot

You can control contributing markup by using a dynamic content spot

You can have a dynamic content spot display only when a particular module is turned on. This is possible by adding, some_module_name to the end of the value that is set for the spot's WP_DynamicContentSpotMappings Resource Environment Provider property in WebSphere® Application Server. If the spot's property value is res:path/to/some/dynamic/content/spot.jsp, and you change it to res:path/to/some/dynamic/content/spot.jsp, some_module_name, that means that the spot.jsp file is only processed when the some_module_name module is turned on. Note you must use a Resource Environment Provider property for this feature to work.

Dynamic content spots and markup contributions are both techniques for adding HTML to a theme, with one important difference. Markup contributions are always placed at the end of the body of the page, while dynamic content spots render wherever they are placed in the theme HTML template.

When a module requires markup, use a markup contribution if it is not important where the module is in the page, such as with iWidget definitions. If the markup must appear in a particular spot in the theme, then a conditional dynamic spot is used.

In the portal 8.0 theme, there is a button in the banner to enter page Edit mode, or return to View mode.

In the theme HTML template, the button is rendered with this dynamic content spot:
<a rel="dynamic-content" href="dyn-cs:id:80theme_pageModeToggle"></a>/
, which maps to this URI through the WP_DynamicContentSpotMappings Resource Environment Provider in WebSphere Application Server: res:/wps/defaultTheme80/themes/html/dynamicSpots/pageModeToggle.jsp, wp_toolbar

The wp_toolbar module contains the JavaScript resources necessary for page editing, so you want the button only to render when this module is on.