protected function slug($text)
 {
     return StringHelper::slug($text);
 }
 /**
  * move page to trash
  */
 public function trash()
 {
     $form = $this->getTrashForm();
     $form->handleRequest($this->app['request']);
     $success = false;
     if ($form->isValid()) {
         try {
             $data = $form->getData();
             $source = $this->getRepository($data['type']);
             $page = $source->findByPath($data['pageId']);
             $target = $this->getRepository('trash');
             $pageId = StringHelper::slug($page->getContentFolderRelativeFolder()) . '-' . basename($page->getPageId()) . '-' . time();
             $target->add($page, $pageId);
             $source->delete($page);
             $success = true;
         } catch (\Exception $e) {
             $message = $e->getMessage();
             $this->flash($message, 'error');
         }
     }
     if ($success) {
         $this->flash($this->trans('message.trash.success'), 'success');
     } else {
         $this->flash($this->trans('message.trash.failure'), 'error');
     }
     return $this->redirect('pages/');
 }