commit 43083d8fee5d228d1fad738fc480d980145d4d7e Author: kgoel Date: Fri May 24 16:44:43 2013 -0400 Issue# 1978976 addressed some issues under comment #18 diff --git a/core/modules/shortcut/lib/Drupal/shortcut/Form/SetSwitch.php b/core/modules/shortcut/lib/Drupal/shortcut/Form/SetSwitch.php index f08eebe..4fae0dc 100644 --- a/core/modules/shortcut/lib/Drupal/shortcut/Form/SetSwitch.php +++ b/core/modules/shortcut/lib/Drupal/shortcut/Form/SetSwitch.php @@ -34,6 +34,7 @@ class SetSwitch implements ControllerInterface, FormInterface { * The entity manager. */ public function __construct(EntityManager $entity_manager) { + $this->entityManager = $entity_manager; $this->currentPath = $request->attributes->get('system_path'); } @@ -56,13 +57,14 @@ public function getFormID() { /** * {@inheritdoc} */ - public function buildForm($form, &$form_state, $account = NULL) { + public function buildForm(array $form, array &$form_state, $account = NULL) { global $user; if (!isset($account)) { $account = $user; } // Prepare the list of shortcut sets. + $this->entityManager->getStorageController('shortcut')->load(); $sets = entity_load_multiple('shortcut'); $current_set = shortcut_current_displayed_set($account); @@ -144,7 +146,7 @@ public function buildForm($form, &$form_state, $account = NULL) { /** * Validation handler for shortcut_set_switch(). */ -function shortcut_set_switch_validate($form, &$form_state) { +function shortcut_set_switch_validate(array $form, array &$form_state) { if ($form_state['values']['set'] == 'new') { // Check to prevent creating a shortcut set with an empty title. if (trim($form_state['values']['label']) == '') { @@ -160,14 +162,14 @@ function shortcut_set_switch_validate($form, &$form_state) { /** * Submit handler for shortcut_set_switch(). */ -function shortcut_set_switch_submit($form, &$form_state) { +function shortcut_set_switch_submit(array $form, array &$form_state) { global $user; $account = $form_state['values']['account']; if ($form_state['values']['set'] == 'new') { // Save a new shortcut set with links copied from the user's default set. $default_set = shortcut_default_set($account); - $set = entity_create('shortcut', array( + $set = entity_create($this->entityType, array( 'id' => $form_state['values']['id'], 'label' => $form_state['values']['label'], 'links' => $default_set->links,