You are here

function _skinr_element_name in Skinr 7.2

Returns the renamed system element.

See also

system_update_7004()

1 call to _skinr_element_name()
skinr_update_7200 in ./skinr.install
Upgrade from Skinr 6.x-1.x or 6.x-2.x.

File

./skinr.install, line 410
Contains install, update, and uninstall functions for Skinr.

Code

function _skinr_element_name($module, $element) {
  if ($module == 'block') {
    list($block_module, $delta) = explode('-', $element, 2);

    // Get an array of the renamed block deltas, organized by module.
    $renamed_deltas = array(
      'blog' => array(
        '0' => 'recent',
      ),
      'book' => array(
        '0' => 'navigation',
      ),
      'comment' => array(
        '0' => 'recent',
      ),
      'forum' => array(
        '0' => 'active',
        '1' => 'new',
      ),
      'locale' => array(
        '0' => LANGUAGE_TYPE_INTERFACE,
      ),
      'node' => array(
        '0' => 'syndicate',
      ),
      'poll' => array(
        '0' => 'recent',
      ),
      'profile' => array(
        '0' => 'author-information',
      ),
      'search' => array(
        '0' => 'form',
      ),
      'statistics' => array(
        '0' => 'popular',
      ),
      'system' => array(
        '0' => 'powered-by',
      ),
      'user' => array(
        '0' => 'login',
        '1' => 'navigation',
        '2' => 'new',
        '3' => 'online',
      ),
    );
    $moved_deltas = array(
      'user' => array(
        'navigation' => 'system',
      ),
    );
    if (isset($renamed_deltas[$block_module][$delta])) {
      $delta = $renamed_deltas[$block_module][$delta];
    }
    if (isset($moved_deltas[$block_module][$delta])) {
      $block_module = $moved_deltas[$block_module][$delta];
    }
    $element = $block_module . '__' . $delta;
  }
  elseif ($module == 'panels') {

    // Strip 'panel-'.
    $element = substr($element, 8);

    // Extract did and pid.
    if (strpos($element, '-region-') !== FALSE) {
      list($did, $pid) = explode('-region-', $element, 2);
      $element = 'region__' . $did . '__' . $pid;
    }
    elseif (strpos($element, '-pane-') !== FALSE) {
      list($did, $pid) = explode('-pane-', $element, 2);
      $element = 'pane__' . $did . '__' . $pid;
    }
    else {
      list($did, $pid) = explode('-pane-', $element, 2);
      $element = 'panel__' . $did;
    }
  }
  elseif ($module == 'views') {
    list($view, $display) = explode('-display-', $element, 2);
    $view = substr($view, 5);
    $element = $view . '__' . $display;
  }
  return $element;
}