function action_delete($identifier) { // Load the item. $relationship = MenuPathRelationship::load($identifier); if ($relationship === false) { drupal_not_found(); return ''; } // Prepare the form. return drupal_get_form('ablecore_menu_delete_relationship', $relationship); }
public function submit($form, &$form_state) { foreach ($form_state['values']['relationships'] as $id => $data) { if (is_array($data) && isset($data['weight']) && isset($data['pid'])) { $relationship = MenuPathRelationship::load($data['pid']); if ($relationship === false) { continue; } $relationship->set('weight', $data['weight']); $relationship->save(); } } drupal_set_message(t('The order of the relationships has been saved.')); }