예제 #1
0
 /**
  * Returns the title to return to after the form has been submitted,
  * or when form use is aborted for some other reason.
  * 
  * @since 0.1
  * 
  * @param boolean $addedItem
  * 
  * @return Title
  */
 protected function getReturnToTitle($addedItem = false)
 {
     if ($this->getRequest()->getCheck('wpreturnto')) {
         return Title::newFromText($this->getRequest()->getText('wpreturnto'));
     } elseif (!$addedItem && $this->isNew()) {
         $c = $this->getItemClass();
         // Yeah, this is needed in PHP 5.3 >_>
         return SpecialPage::getTitleFor($c::getListPage());
     } elseif ($this->item !== false) {
         return $this->item->getTitle();
     } else {
         $c = $this->getItemClass();
         // Yeah, this is needed in PHP 5.3 >_>
         $fieldName = 'wpitem-' . $c::getIdentifierField();
         if ($this->getRequest()->getCheck($fieldName)) {
             return $c::getTitleFor($this->getRequest()->getText($fieldName));
         } else {
             return $this->getTitle();
         }
     }
 }