function alpha_calculate_position

cis7 alpha.inc alpha_calculate_position(&$items)
cle7 alpha.inc alpha_calculate_position(&$items)
elmsmedia7 alpha.inc alpha_calculate_position(&$items)
icor7 alpha.inc alpha_calculate_position(&$items)
meedjum_blog7 alpha.inc alpha_calculate_position(&$items)
mooc7 alpha.inc alpha_calculate_position(&$items)

Calculates the position of a element in a grid container by using the #weight as the DOM position and then calculation the required pull and push CSS classes to move the affected elements to their proper #position value.

Parameters

&$items: An array of grid elements.

1 call to alpha_calculate_position()
alpha_alpha_page_structure_alter in sites/all/themes/ulmus/omega/alpha/template.php
Implements hook_alpha_page_alter().

File

sites/all/themes/ulmus/omega/alpha/includes/alpha.inc, line 913
Helper functions for the Alpha base theme.

Code

function alpha_calculate_position(&$items) {
  if (!empty($items)) {
    $children = element_children($items, TRUE);

    foreach ($children as $a => $item) {
      foreach ($children as $b => $inner) {
        if ($item != $inner) {
          if ($a >= $b && $items[$item]['#position'] < $items[$inner]['#position']) {
            $items[$item]['#grid']['pull'] += $items[$inner]['#grid']['columns'] + $items[$inner]['#grid']['prefix'] + $items[$inner]['#grid']['suffix'];
          }
          else if ($a <= $b && $items[$item]['#position'] > $items[$inner]['#position']) {
            $items[$item]['#grid']['push'] += $items[$inner]['#grid']['columns'] + $items[$inner]['#grid']['prefix'] + $items[$inner]['#grid']['suffix'];
          }
        }
      }

      if ($items[$item]['#grid']['pull'] > $items[$item]['#grid']['push']) {
        $items[$item]['#grid']['pull'] -= $items[$item]['#grid']['push'];
        $items[$item]['#grid']['push'] = 0;
      }
      else if ($items[$item]['#grid']['pull'] > $items[$item]['#grid']['push']) {
        $items[$item]['#grid']['push'] -= $items[$item]['#grid']['pull'];
        $items[$item]['#grid']['pull'] = 0;
      }
      else if ($items[$item]['#grid']['pull'] == $items[$item]['#grid']['push']) {
        $items[$item]['#grid']['pull'] = 0;
        $items[$item]['#grid']['push'] = 0;
      }
    }
  }
}
Error | ELMSLN API

Error

×

Error message

  • Warning: Cannot modify header information - headers already sent by (output started at /var/www/html/elmsln_community/api.elmsln.org/includes/common.inc:2791) in drupal_send_headers() (line 1499 of /var/www/html/elmsln_community/api.elmsln.org/includes/bootstrap.inc).
  • Error: Call to undefined function apc_delete() in DrupalAPCCache->clear() (line 289 of /var/www/html/elmsln_community/api.elmsln.org/sites/all/modules/apc/drupal_apc_cache.inc).
The website encountered an unexpected error. Please try again later.