/**
* @file
* Provides overridable theme functions for all of Edit's client-side HTML.
*/
(function ($, Drupal) {
"use strict";
/**
* Theme function for a "backstage" for the Edit module.
*
* @param Object settings
* An object with the following keys:
* - String id: the id to apply to the backstage.
* @return String
* The corresponding HTML.
*/
Drupal.theme.editBackstage = function (settings) {
var html = '';
html += '
';
return html;
};
/**
* Theme function for a modal of the Edit module.
*
* @return String
* The corresponding HTML.
*/
Drupal.theme.editModal = function () {
var classes = 'edit-animate-slow edit-animate-invisible edit-animate-delay-veryfast';
var html = '';
html += '
';
html += '
';
html += ' ';
html += '
';
return html;
};
/**
* Theme function for a toolbar container of the Edit module.
*
* @param Object settings
* An object with the following keys:
* - String id: the id to apply to the toolbar container.
* @return String
* The corresponding HTML.
*/
Drupal.theme.editEntityToolbar = function (settings) {
var html = '';
html += '
';
html += '';
html += '
';
html += '
';
html += '';
html += '
';
html += '';
html += '
';
return html;
};
/**
* Theme function for a toolbar container of the Edit module.
*
* @param Object settings
* An object with the following keys:
* - String entityLabel: The title of the active entity.
* - String fieldLabel: The label of the highlighted or active field.
* @return String
* The corresponding HTML.
*/
Drupal.theme.editEntityToolbarLabel = function (settings) {
return settings.entityLabel + ': ' + settings.fieldLabel + '';
};
/**
* Element that defines a containing box of the placement of the entity toolbar.
*
* @return String
* The corresponding HTML.
*/
Drupal.theme.editEntityToolbarFence = function () {
return '';
};
/**
* Theme function for a toolbar container of the Edit module.
*
* @param settings
* An object with the following keys:
* - id: the id to apply to the toolbar container.
* @return
* The corresponding HTML.
*/
Drupal.theme.editFieldToolbar = function (settings) {
return '';
};
/**
* Theme function for a toolbar toolgroup of the Edit module.
*
* @param Object settings
* An object with the following keys:
* - String id: (optional) the id of the toolgroup
* - String classes: the class of the toolgroup.
* - Array buttons: @see Drupal.theme.prototype.editButtons().
* @return String
* The corresponding HTML.
*/
Drupal.theme.editToolgroup = function (settings) {
// Classes.
var classes = (settings.classes || []);
classes.unshift('edit-toolgroup');
var html = '';
html += '
';
html += Drupal.theme('editButtons', { buttons: settings.buttons });
html += '
';
return html;
};
/**
* Theme function for buttons of the Edit module.
*
* Can be used for the buttons both in the toolbar toolgroups and in the modal.
*
* @param Object settings
* An object with the following keys:
* - buttons: an array of objects with the following keys:
* - String type: the type of the button (defaults to 'button')
* - Array classes: the classes of the button.
* - String label: the label of the button.
* - String action: sets a data-edit-modal-action attribute.
* @return String
* The corresponding HTML.
*/
Drupal.theme.editButtons = function (settings) {
var html = '';
for (var i = 0; i < settings.buttons.length; i++) {
var button = settings.buttons[i];
if (!button.hasOwnProperty('type')) {
button.type = 'button';
}
// Attributes.
var attributes = [];
var attrMap = settings.buttons[i].attributes || {};
for (var attr in attrMap) {
if (attrMap.hasOwnProperty(attr)) {
attributes.push(attr + ((attrMap[attr]) ? '="' + attrMap[attr] + '"' : '' ));
}
}
html += '';
}
return html;
};
/**
* Theme function for a form container of the Edit module.
*
* @param Object settings
* An object with the following keys:
* - String id: the id to apply to the toolbar container.
* - String loadingMsg: The message to show while loading.
* @return String
* The corresponding HTML.
*/
Drupal.theme.editFormContainer = function (settings) {
var html = '';
html += '