3 * Provides theme functions for image Quick Edit's client-side HTML.
8 * Theme function for validation errors of the Image in-place editor.
10 * @param {object} settings
11 * Settings object used to construct the markup.
12 * @param {string} settings.errors
13 * Already escaped HTML representing error messages.
16 * The corresponding HTML.
18 Drupal.theme.quickeditImageErrors = function (settings) {
19 return `<div class="quickedit-image-errors">${settings.errors}</div>`;
23 * Theme function for the dropzone element of the Image module's in-place
26 * @param {object} settings
27 * Settings object used to construct the markup.
28 * @param {string} settings.state
29 * State of the upload.
30 * @param {string} settings.text
31 * Text to display inline with the dropzone element.
34 * The corresponding HTML.
36 Drupal.theme.quickeditImageDropzone = function (settings) {
37 return `<div class="quickedit-image-dropzone ${settings.state}">` +
38 ' <i class="quickedit-image-icon"></i>' +
39 ` <span class="quickedit-image-text">${settings.text}</span>` +
44 * Theme function for the toolbar of the Image module's in-place editor.
46 * @param {object} settings
47 * Settings object used to construct the markup.
48 * @param {bool} settings.alt_field
49 * Whether or not the "Alt" field is enabled for this field.
50 * @param {bool} settings.alt_field_required
51 * Whether or not the "Alt" field is required for this field.
52 * @param {string} settings.alt
53 * The current value for the "Alt" field.
54 * @param {bool} settings.title_field
55 * Whether or not the "Title" field is enabled for this field.
56 * @param {bool} settings.title_field_required
57 * Whether or not the "Title" field is required for this field.
58 * @param {string} settings.title
59 * The current value for the "Title" field.
62 * The corresponding HTML.
64 Drupal.theme.quickeditImageToolbar = function (settings) {
65 let html = '<form class="quickedit-image-field-info">';
66 if (settings.alt_field) {
68 ' <label for="alt" class="'}${settings.alt_field_required ? 'required' : ''}">${Drupal.t('Alternative text')}</label>` +
69 ` <input type="text" placeholder="${settings.alt}" value="${settings.alt}" name="alt" ${settings.alt_field_required ? 'required' : ''}/>` +
72 if (settings.title_field) {
74 ' <label for="title" class="'}${settings.title_field_required ? 'form-required' : ''}">${Drupal.t('Title')}</label>` +
75 ` <input type="text" placeholder="${settings.title}" value="${settings.title}" name="title" ${settings.title_field_required ? 'required' : ''}/>` +