Modify instead of add a class in classes_array for theming purposes I am using the following preprocess in my template.php

function paddle_admin_preprocess_menu_block_wrapper(&amp;$variables) {
  if ($variables['delta'] === 'management_level_2') {
    $variables['classes_array'][] = 'max-width';
  }
}


It works as intended, it adds a class when the delta equals this string.. 

I am trying to modify another other entry of the classes_array array in order to make the classname more semantic. How would I go for that? (so replace an entry instead of add)

ps: I figured it can be as easy as:

$variables['classes_array'][1] = $variables['delta']; 


but I am wondering whether the array indexes can change (from the ones I see with devel themer)
Search for the key of the value you want to replace and then modify it. It's that simple.

function paddle_admin_preprocess_menu_block_wrapper(&amp;$variables) {
  if ($variables['delta'] === 'management_level_2') {
    // Search for the key
    $key = array_search('class_to_be_replaced', $variables['classes_array']);

    // If class was found, replace it
    if ($key !== FALSE) {
        $variables['classes_array'][$key] = 'class_that_replaces';
    }
  }
}