Chris@0: /** Chris@0: * @file Chris@0: * Provides theme functions for all of Quick Edit's client-side HTML. Chris@0: */ Chris@0: Chris@17: (function($, Drupal) { Chris@0: /** Chris@0: * Theme function for a "backstage" for the Quick Edit module. Chris@0: * Chris@0: * @param {object} settings Chris@0: * Settings object used to construct the markup. Chris@0: * @param {string} settings.id Chris@0: * The id to apply to the backstage. Chris@0: * Chris@0: * @return {string} Chris@0: * The corresponding HTML. Chris@0: */ Chris@17: Drupal.theme.quickeditBackstage = function(settings) { Chris@0: let html = ''; Chris@0: html += `
`; Chris@0: return html; Chris@0: }; Chris@0: Chris@0: /** Chris@0: * Theme function for a toolbar container of the Quick Edit module. Chris@0: * Chris@0: * @param {object} settings Chris@0: * Settings object used to construct the markup. Chris@0: * @param {string} settings.id Chris@0: * the id to apply to the backstage. Chris@0: * Chris@0: * @return {string} Chris@0: * The corresponding HTML. Chris@0: */ Chris@17: Drupal.theme.quickeditEntityToolbar = function(settings) { Chris@0: let html = ''; Chris@17: html += ` '; Chris@0: return html; Chris@0: }; Chris@0: Chris@0: /** Chris@0: * Theme function for a toolbar container of the Quick Edit module. Chris@0: * Chris@0: * @param {object} settings Chris@0: * Settings object used to construct the markup. Chris@0: * @param {string} settings.entityLabel Chris@0: * The title of the active entity. Chris@0: * @param {string} settings.fieldLabel Chris@0: * The label of the highlighted or active field. Chris@0: * Chris@0: * @return {string} Chris@0: * The corresponding HTML. Chris@0: */ Chris@17: Drupal.theme.quickeditEntityToolbarLabel = function(settings) { Chris@0: // @todo Add XSS regression test coverage in https://www.drupal.org/node/2547437 Chris@17: return `${Drupal.checkPlain( Chris@17: settings.fieldLabel, Chris@17: )}${Drupal.checkPlain(settings.entityLabel)}`; Chris@0: }; Chris@0: Chris@0: /** Chris@0: * Element defining a containing box for the placement of the entity toolbar. Chris@0: * Chris@0: * @return {string} Chris@0: * The corresponding HTML. Chris@0: */ Chris@17: Drupal.theme.quickeditEntityToolbarFence = function() { Chris@0: return ''; Chris@0: }; Chris@0: Chris@0: /** Chris@0: * Theme function for a toolbar container of the Quick Edit module. Chris@0: * Chris@0: * @param {object} settings Chris@0: * Settings object used to construct the markup. Chris@0: * @param {string} settings.id Chris@0: * The id to apply to the toolbar container. Chris@0: * Chris@0: * @return {string} Chris@0: * The corresponding HTML. Chris@0: */ Chris@17: Drupal.theme.quickeditFieldToolbar = function(settings) { Chris@0: return ``; Chris@0: }; Chris@0: Chris@0: /** Chris@0: * Theme function for a toolbar toolgroup of the Quick Edit module. Chris@0: * Chris@0: * @param {object} settings Chris@0: * Settings object used to construct the markup. Chris@0: * @param {string} [settings.id] Chris@0: * The id of the toolgroup. Chris@0: * @param {string} settings.classes Chris@0: * The class of the toolgroup. Chris@0: * @param {Array} settings.buttons Chris@0: * See {@link Drupal.theme.quickeditButtons}. Chris@0: * Chris@0: * @return {string} Chris@0: * The corresponding HTML. Chris@0: */ Chris@17: Drupal.theme.quickeditToolgroup = function(settings) { Chris@0: // Classes. Chris@17: const classes = settings.classes || []; Chris@0: classes.unshift('quickedit-toolgroup'); Chris@0: let html = ''; Chris@0: html += `