diff --git a/election.constants.inc b/election.constants.inc index d4ffafb47dbd3a99e31154ba828ad103bc64f6f3..5fffd35e427962c5787cdcd7483e1f49d0f603af 100644 --- a/election.constants.inc +++ b/election.constants.inc @@ -27,4 +27,5 @@ define('ELECTION_CANDIDATE_APPROVED', 1); define('ELECTION_CANDIDATE_PENDING', 0); define('ELECTION_CANDIDATE_REJECTED', -1); +// Cardinality of the nomination form's "seconder" field (instance of "endorser"). define('ELECTION_CANDIDATE_MAX_SECONDERS', 10); diff --git a/election.module b/election.module index 2215bff7790290df1da0c2537665715170a252c5..7f90abe2a8e437e3d90ae1c649539b8ce6bf8b23 100644 --- a/election.module +++ b/election.module @@ -860,11 +860,20 @@ function election_save($election) { } /** - * Implements hook_entity_presave(). + * Implements hook_entity_insert(). */ -function election_election_presave($election) { +function election_election_insert($election) { if (function_exists('pathauto_election_update_alias')) { - pathauto_election_update_alias($election, $op); + pathauto_election_update_alias($election, 'insert'); + } +} + +/** + * Implements hook_entity_update(). + */ +function election_election_update($election) { + if (function_exists('pathauto_election_update_alias')) { + pathauto_election_update_alias($election, 'update'); } } @@ -1111,8 +1120,14 @@ function pathauto_election_update_alias(stdClass $election, $op, array $options return; } module_load_include('inc', 'pathauto'); - $uri = entity_uri('election', $election); - pathauto_create_alias('election', $op, $uri['path'], array('election' => $election), $election->type, $options['language']); + pathauto_create_alias( + 'election', + $op, + election_uri_path($election), + array('election' => $election), + $election->type, + $options['language'] + ); } /**