public function Container::preprocess in Open Social 8.2
Same name and namespace in other branches
- 8.9 themes/socialbase/src/Plugin/Preprocess/Container.php \Drupal\socialbase\Plugin\Preprocess\Container::preprocess()
- 8 themes/socialbase/src/Plugin/Preprocess/Container.php \Drupal\socialbase\Plugin\Preprocess\Container::preprocess()
- 8.3 themes/socialbase/src/Plugin/Preprocess/Container.php \Drupal\socialbase\Plugin\Preprocess\Container::preprocess()
- 8.4 themes/socialbase/src/Plugin/Preprocess/Container.php \Drupal\socialbase\Plugin\Preprocess\Container::preprocess()
- 8.5 themes/socialbase/src/Plugin/Preprocess/Container.php \Drupal\socialbase\Plugin\Preprocess\Container::preprocess()
- 8.6 themes/socialbase/src/Plugin/Preprocess/Container.php \Drupal\socialbase\Plugin\Preprocess\Container::preprocess()
- 8.7 themes/socialbase/src/Plugin/Preprocess/Container.php \Drupal\socialbase\Plugin\Preprocess\Container::preprocess()
- 8.8 themes/socialbase/src/Plugin/Preprocess/Container.php \Drupal\socialbase\Plugin\Preprocess\Container::preprocess()
Preprocess theme hook variables.
Parameters
array $variables: The variables array, passed by reference (modify in place).
string $hook: The name of the theme hook.
array $info: The theme hook info array.
Overrides PreprocessBase::preprocess
File
- themes/
socialbase/ src/ Plugin/ Preprocess/ Container.php, line 20
Class
- Container
- Pre-processes variables for the "container" theme hook.
Namespace
Drupal\socialbase\Plugin\PreprocessCode
public function preprocess(array &$variables, $hook, array $info) {
parent::preprocess($variables, $hook, $info);
// For pages in search we would like to render containers without divs.
$routename = \Drupal::request()
->get(RouteObjectInterface::ROUTE_NAME);
if (strpos($routename, 'search') !== FALSE) {
// Exclude the filter block on the search page.
if (!isset($variables['element']['#exposed_form'])) {
$variables['bare'] = TRUE;
}
}
// Remove extra wrapper for container of post image form.
if (isset($variables['element']['#id']) && $variables['element']['#id'] == 'edit-field-comment-files-wrapper') {
$variables['bare'] = TRUE;
}
if (isset($variables['element']['#inline'])) {
$variables['bare'] = TRUE;
}
if (isset($variables['element']['#type']) && $variables['element']['#type'] == 'view') {
$variables['bare'] = TRUE;
}
// Identify the container used for search in the nav bar.
// Var is set in hook_preprocess_block.
if (isset($variables['element']['#addsearchicon'])) {
$variables['bare'] = TRUE;
}
// Identify the container used for views_exposed filter.
// Var is set in hook_preprocess_views_exposed_form.
if (isset($variables['element']['#exposed_form'])) {
$variables['exposed_form'] = TRUE;
}
}