You are here

function clock_get_weight in Clock 7.2

Calculates the weight of a new clock.

Newly added clocks are assumed to be added to the bottom of the list of clocks. This function always returns a weight, that is one greater than the highest weight already in use.

Return value

An integer containing the weight of the new clock.

1 call to clock_get_weight()
clock_add_form_submit in ./clock.admin.inc
Form submission handler for clock_add_form().

File

./clock.module, line 573
Display clocks on your site.

Code

function clock_get_weight() {
  $info = clock_info();
  $weight = 0;
  foreach ($info as $clock) {
    if ($clock->weight >= $weight) {
      $weight = $clock->weight + 1;
    }
  }
  return $weight;
}