private function BlockService::clearEmptyPositions in Opigno dashboard 3.x
Clear empty positions.
Parameters
array $positions: Blocks positioning.
array $availables_keys: The list of available keys.
1 call to BlockService::clearEmptyPositions()
- BlockService::getPositioning in src/
BlockService.php - Returns positioning.
File
- src/
BlockService.php, line 425
Class
- BlockService
- The dashboard block manager service definition.
Namespace
Drupal\opigno_dashboardCode
private function clearEmptyPositions(array &$positions, array $availables_keys) {
foreach ($positions as $c_key => $columns) {
if (!is_array($columns)) {
continue;
}
foreach ($columns as $key => $position) {
if (!is_array($columns)) {
continue;
}
// Unset empty arrays and removed blocks.
if (!isset($position['id']) || isset($position['id']) && !in_array($position['id'], $availables_keys)) {
unset($positions[$c_key][$key]);
}
}
// Reset array keys.
$positions[$c_key] = array_values($positions[$c_key]);
}
}