protected function willFilterPage(array $page)
 {
     $panels = PhabricatorProfilePanel::getAllPanels();
     foreach ($page as $key => $panel) {
         $panel_type = idx($panels, $panel->getPanelKey());
         if (!$panel_type) {
             $this->didRejectResult($panel);
             unset($page[$key]);
             continue;
         }
         $panel->attachPanel($panel_type);
     }
     if (!$page) {
         return array();
     }
     $profile_phids = mpull($page, 'getProfilePHID');
     $profiles = id(new PhabricatorObjectQuery())->setViewer($this->getViewer())->setParentQuery($this)->withPHIDs($profile_phids)->execute();
     $profiles = mpull($profiles, null, 'getPHID');
     foreach ($page as $key => $panel) {
         $profile = idx($profiles, $panel->getProfilePHID());
         if (!$profile) {
             $this->didRejectResult($panel);
             unset($page[$key]);
             continue;
         }
         $panel->attachProfileObject($profile);
     }
     return $page;
 }
 private function buildPanelNewContent($panel_key)
 {
     $panel_types = PhabricatorProfilePanel::getAllPanels();
     $panel_type = idx($panel_types, $panel_key);
     if (!$panel_type) {
         return new Aphront404Response();
     }
     $object = $this->getProfileObject();
     if (!$panel_type->canAddToObject($object)) {
         return new Aphront404Response();
     }
     $configuration = PhabricatorProfilePanelConfiguration::initializeNewPanelConfiguration($object, $panel_type);
     $viewer = $this->getViewer();
     PhabricatorPolicyFilter::requireCapability($viewer, $configuration, PhabricatorPolicyCapability::CAN_EDIT);
     $controller = $this->getController();
     return id(new PhabricatorProfilePanelEditEngine())->setPanelEngine($this)->setProfileObject($object)->setNewPanelConfiguration($configuration)->setController($controller)->buildResponse();
 }