ElementRemoveAction.class.php (695B)
1 <?php 2 namespace cms\action\element; 3 use cms\action\Action; 4 use cms\action\ElementAction; 5 use cms\action\Method; 6 use language\Messages; 7 8 9 class ElementRemoveAction extends ElementAction implements Method { 10 public function view() { 11 $this->setTemplateVar( 'name' ,$this->element->name ); 12 } 13 14 public function post() { 15 $type = $this->request->getAlphanum('type'); 16 17 if ( $type == 'value' ) 18 { 19 // Nur Inhalte löschen 20 $this->element->deleteValues(); 21 $this->addNoticeFor( $this->element, Messages::DELETED); 22 } 23 elseif ( $type == 'all' ) 24 { 25 // Element löschen 26 $this->element->delete(); 27 $this->addNoticeFor( $this->element, Messages::DELETED); 28 } 29 } 30 }