Early Bird Registration for DrupalCon Portland 2024 is open! Register by 23:59 PST on 31 March 2024, to get $100 off your ticket.
Tracking down this Label:
<div id="edit-selected" class="form-item form-type-item form-item-selected" style="display: block;">
<label for="edit-selected">Selected:</label>
<div class="views-selected-options">Content: User posted or commented, Tracker - User: User posted or commented</div>
</div>
Which seems to come from core/modules/views_ui/lib/Drupal/views_ui/Form/Ajax/AddItem.php and :
// Add a div to show the selected items
$form['selected'] = array(
'#type' => 'item',
'#markup' => '<div class="views-selected-options"></div>',
'#title' => t('Selected') . ':',
'#theme_wrappers' => array('form_element', 'views_ui_container'),
'#attributes' => array('class' => array('container-inline', 'views-add-form-selected')),
);
Comment | File | Size | Author |
---|---|---|---|
#9 | drupal8-RemovedLabel-2044521-9.patch | 915 bytes | DuaelFr |
#7 | drupal8-RemovedLabel-2044521-7.patch | 915 bytes | bowersox |
#7 | Screen Shot 2013-07-21 at 4.12.22 PM.png | 207.76 KB | bowersox |
Screen Shot 2013-07-17 at 8.21.37 PM.png | 125.14 KB | mgifford |
Comments
Comment #1
dawehner.
Comment #2
jabberwooki CreditAttribution: jabberwooki commentedApparently, the tag is generated by the Form API, based on the following key :
'#title' => t('Selected') . ':',
in the $form['selected'] array.
I'm not sure this issue has to be tagged "Novice". People knowing the Form API are more experienced to tackle this point.
Comment #3
bowersox CreditAttribution: bowersox commentedLet's define the desired solution. What markup should we have, and what Form API attributes will generate that?
We could use a span...
<span class="views-selected-label">Selected:</span>
and define that new class in views_ui.admin.theme.css...
.views-selected-label { font-weight: bold; }
Should we use an H3/H4 instead of span? In other places in core we've used headings, but here we want this label to be inline, and semantically a heading is not appropriate. A span is probably more appropriate.
To apply this span markup using the Forms API, we could get rid of the
#title
attribute and put the span into the #markup attribute.Feedback appreciated.
Comment #4
dawehnerI would go with the same kind of html as the normal "label" on a views field. This label switched to a different html element before.
Comment #5
bowersox CreditAttribution: bowersox commented@dawehner, do you have an issue number to reference?
Comment #6
bowersox CreditAttribution: bowersox commentedComment #7
bowersox CreditAttribution: bowersox commentedPlease review this patch. It makes use of an existing CSS class and generates this markup:
Also, the double-colon is now a single-colon. I assume that is the desired visual look. Screenshot attached.
To test this, open up Structure > Views, then edit any view, then under Fields click the Add button. Once the popup opens and you select a field, this "Selected:" bit appears at the bottom.
Comment #8
mparker17Code looks good. Patch works as advertised.
Comment #9
DuaelFrThe single-colon should be included in the
t()
to be consistent with core and to allow non-english people to add a space before if this is how their language work.See :
Comment #10
dawehnerThank you!
Comment #11
alexpottCommitted 4dfc5e3 and pushed to 8.x. Thanks!