public function IpGeoLocViewsPluginStyle::pluginStyleAddLabelAndStyling in IP Geolocation Views & Maps 8
Style field value, label and wrapper around both, where requested.
Note: the "Add default classes" tickbox, options['element_default_classes'], is NOT supported to avoid the balloons having excessive bulky markup.
Parameters
string $field: The field.
string $field_content: The content of the field.
Return value
string $field_content wrapped in HTML with CSS classes
2 calls to IpGeoLocViewsPluginStyle::pluginStyleAddLabelAndStyling()
- IpGeoLocViewsPluginStyle::pluginStyleDecorate in src/
Services/ IpGeoLocViewsPluginStyle.php - Pending doc.
- IpGeoLocViewsPluginStyle::pluginStyleRenderFields in src/
Services/ IpGeoLocViewsPluginStyle.php - Perform token replacement, convert timestamps to date strings etc.
File
- src/
Services/ IpGeoLocViewsPluginStyle.php, line 1161
Class
- IpGeoLocViewsPluginStyle
- Class IpGeoLocViewsPluginStyle.
Namespace
Drupal\ip_geoloc\ServicesCode
public function pluginStyleAddLabelAndStyling($field, $field_content) {
if ($field_content_type = $field
->elementType(TRUE, TRUE)) {
$element = '<' . $field_content_type;
if ($field_content_class = $field
->elementClasses(NULL)) {
$element .= ' class="' . $field_content_class . '"';
}
$element .= '>';
$close_element = '</' . $field_content_type . '>';
$field_content = $element . $field_content . $close_element;
}
$label = $field
->label();
if ($label && $field->options['element_label_colon']) {
$label .= ': ';
}
$label_and_field_content = $label . $field_content;
if ($label_type = $field
->elementLabelType(TRUE, TRUE)) {
$element = '<' . $label_type;
if ($label_class = $field
->elementLabelClasses(NULL)) {
$element .= ' class="' . $label_class . '"';
}
$element .= '>';
$close_element = '</' . $label_type . '>';
$label_and_field_content = $element . $label . $close_element . $field_content;
}
if ($wrapper_type = $field
->elementWrapperType(TRUE, TRUE)) {
$element = '<' . $wrapper_type;
if ($wrapper_class = $field
->elementWrapperClasses(NULL)) {
$element .= ' class="' . $wrapper_class . '"';
}
$element .= '>';
$close_element = '</' . $wrapper_type . '>';
return $element . $label_and_field_content . $close_element;
}
return $label_and_field_content;
}