Changeset View
Changeset View
Standalone View
Standalone View
src/applications/search/engine/PhabricatorProfileMenuEngine.php
Show First 20 Lines • Show All 230 Lines • ▼ Show 20 Lines | if (!$is_view) { | ||||
} | } | ||||
$page_title = pht('Configure Menu'); | $page_title = pht('Configure Menu'); | ||||
} else { | } else { | ||||
$page_title = $selected_item->getDisplayName(); | $page_title = $selected_item->getDisplayName(); | ||||
} | } | ||||
switch ($item_action) { | switch ($item_action) { | ||||
case 'view': | case 'view': | ||||
$navigation->selectFilter($selected_item->getDefaultMenuItemKey()); | $navigation->selectFilter($selected_item->getDefaultMenuItemKey()); | ||||
epriestley: Selection occurs here. | |||||
try { | try { | ||||
$content = $this->buildItemViewContent($selected_item); | $content = $this->buildItemViewContent($selected_item); | ||||
} catch (Exception $ex) { | } catch (Exception $ex) { | ||||
$content = id(new PHUIInfoView()) | $content = id(new PHUIInfoView()) | ||||
->setTitle(pht('Unable to Render Dashboard')) | ->setTitle(pht('Unable to Render Dashboard')) | ||||
->setErrors(array($ex->getMessage())); | ->setErrors(array($ex->getMessage())); | ||||
} | } | ||||
▲ Show 20 Lines • Show All 112 Lines • ▼ Show 20 Lines | foreach ($menu_items as $menu_item) { | ||||
$filtered_items[] = $menu_item; | $filtered_items[] = $menu_item; | ||||
} | } | ||||
$filtered_groups = mgroup($filtered_items, 'getMenuItemKey'); | $filtered_groups = mgroup($filtered_items, 'getMenuItemKey'); | ||||
foreach ($filtered_groups as $group) { | foreach ($filtered_groups as $group) { | ||||
$first_item = head($group); | $first_item = head($group); | ||||
$first_item->willBuildNavigationItems($group); | $first_item->willBuildNavigationItems($group); | ||||
} | } | ||||
$selected_item = null; | |||||
foreach ($menu_items as $menu_item) { | foreach ($menu_items as $menu_item) { | ||||
if ($menu_item->isDisabled()) { | if ($menu_item->isDisabled()) { | ||||
continue; | continue; | ||||
} | } | ||||
$items = $menu_item->buildNavigationMenuItems(); | $items = $menu_item->buildNavigationMenuItems(); | ||||
foreach ($items as $item) { | foreach ($items as $item) { | ||||
$this->validateNavigationMenuItem($item); | $this->validateNavigationMenuItem($item); | ||||
} | } | ||||
// If the item produced only a single item which does not otherwise | // If the item produced only a single item which does not otherwise | ||||
// have a key, try to automatically assign it a reasonable key. This | // have a key, try to automatically assign it a reasonable key. This | ||||
// makes selecting the correct item simpler. | // makes selecting the correct item simpler. | ||||
if (count($items) == 1) { | if (count($items) == 1) { | ||||
$item = head($items); | $item = head($items); | ||||
if ($item->getKey() === null) { | if ($item->getKey() === null) { | ||||
$default_key = $menu_item->getDefaultMenuItemKey(); | $default_key = $menu_item->getDefaultMenuItemKey(); | ||||
$item->setKey($default_key); | $item->setKey($default_key); | ||||
} | } | ||||
if ($menu_item->needsFilter()) { | |||||
$selected_item = $item->getKey(); | |||||
} | |||||
} | } | ||||
foreach ($items as $item) { | foreach ($items as $item) { | ||||
$nav->addMenuItem($item); | $nav->addMenuItem($item); | ||||
} | } | ||||
} | } | ||||
$nav->selectFilter(null); | $nav->selectFilter($selected_item); | ||||
$this->navigation = $nav; | $this->navigation = $nav; | ||||
return $this->navigation; | return $this->navigation; | ||||
} | } | ||||
private function getItems() { | private function getItems() { | ||||
if ($this->items === null) { | if ($this->items === null) { | ||||
$this->items = $this->loadItems(self::MODE_COMBINED); | $this->items = $this->loadItems(self::MODE_COMBINED); | ||||
▲ Show 20 Lines • Show All 922 Lines • Show Last 20 Lines |
Selection occurs here.