Skip to content
Snippets Groups Projects
Commit eeb4b578 authored by Jay Friendly's avatar Jay Friendly
Browse files

Issue #2939723 by Jaypan: D8 - Use module specific classes to ensure they are...

Issue #2939723 by Jaypan: D8 - Use module specific classes to ensure they are always present regardless of theme
parent 5a19f6e1
No related branches found
No related tags found
No related merge requests found
......@@ -490,3 +490,34 @@ function private_message_message_view_alter(array &$build) {
}
}
}
/**
* Implements hook_preprocess_field().
*
* Adds a custom class to the field that can be targeted, as the default classes
* may be altered in themes/templates, and therefore should not be depended
* upon.
*/
function private_message_preprocess_field__private_message_thread__private_messages(&$vars) {
foreach (array_keys($vars['items']) as $index) {
$vars['items'][$index]['attributes']->setAttribute('class', 'private-message-wrapper');
}
}
/**
* Implements hook_preprocess_field().
*
* Adds a custom class to the containers that can be targeted, as the default
* classes may be altered in themes/templates, and therefore should not be
* depended upon.
*/
function private_message_preprocess_container(&$vars) {
if (strpos('edit-members-wrapper', $vars['element']['#id']) === 0) {
// Add a custom class to the private message members widget container.
$vars['attributes']['class'][] = 'private_message_members_widget_default_wrapper';
}
elseif (strpos('edit-message-wrapper', $vars['element']['#id']) === 0) {
// Add a custom class to the private message message widget container.
$vars['attributes']['class'][] = 'private_message_message_widget_default_wrapper';
}
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment