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')),
    );

Screen Shot 2013-07-17 at 8.21.37 PM.png

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

dawehner’s picture

Issue tags: +Novice, +VDC

.

jabberwooki’s picture

Apparently, 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.

bowersox’s picture

Let'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.

dawehner’s picture

I 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.

bowersox’s picture

@dawehner, do you have an issue number to reference?

bowersox’s picture

Issue tags: +TwinCities
bowersox’s picture

Status: Active » Needs review
FileSize
207.76 KB
915 bytes

Please review this patch. It makes use of an existing CSS class and generates this markup:

<span class="views-ui-view-title">Selected:</span>

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.

mparker17’s picture

Status: Needs review » Reviewed & tested by the community

Code looks good. Patch works as advertised.

DuaelFr’s picture

Status: Reviewed & tested by the community » Needs review
FileSize
915 bytes

The 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 :

  • core/modules/action/lib/Drupal/action/ActionListController.php:123
  • core/modules/field_ui/lib/Drupal/field_ui/DisplayOverview.php:63
  • core/modules/forum/forum.module:23
  • core/modules/help/lib/Drupal/help/Tests/HelpTest.php:76
  • core/modules/help/lib/Drupal/help/Controller/HelpController.php:53
  • core/modules/locale/lib/Drupal/locale/Tests/LocaleUpdateInterfaceTest.php:92:
  • core/modules/locale/locale.pages.inc:805:
  • core/modules/locale/locale.install:327:
  • ...
dawehner’s picture

Status: Needs review » Reviewed & tested by the community

Thank you!

alexpott’s picture

Status: Reviewed & tested by the community » Fixed

Committed 4dfc5e3 and pushed to 8.x. Thanks!

Automatically closed -- issue fixed for 2 weeks with no activity.