FeedUnlockForm.php in Feeds 8.3
File
src/Form/FeedUnlockForm.php
View source
<?php
namespace Drupal\feeds\Form;
use Drupal\Core\Entity\ContentEntityConfirmFormBase;
use Drupal\Core\Form\FormStateInterface;
class FeedUnlockForm extends ContentEntityConfirmFormBase {
public function getQuestion() {
return $this
->t('Are you sure you want to unlock the feed %feed?', [
'%feed' => $this->entity
->label(),
]);
}
public function getCancelUrl() {
return $this->entity
->toUrl();
}
public function getConfirmText() {
return $this
->t('Unlock');
}
public function submitForm(array &$form, FormStateInterface $form_state) {
$this->entity
->unlock();
$args = [
'@type' => $this->entity
->getType()
->label(),
'%title' => $this->entity
->label(),
];
$this
->logger('feeds')
->notice('@type: unlocked %title.', $args);
$this
->messenger()
->addMessage($this
->t('%title has been unlocked.', $args));
$form_state
->setRedirectUrl($this
->getCancelUrl());
}
}