class FeedForm
Same name and namespace in other branches
- 8.9.x core/modules/aggregator/src/FeedForm.php \Drupal\aggregator\FeedForm
Form handler for the aggregator feed edit forms.
@internal
Hierarchy
- class \Drupal\Core\Form\FormBase implements \Drupal\Core\Form\FormInterface, \Drupal\Core\DependencyInjection\ContainerInjectionInterface uses \Drupal\Core\DependencyInjection\DependencySerializationTrait, \Drupal\Core\Logger\LoggerChannelTrait, \Drupal\Core\Messenger\MessengerTrait, \Drupal\Core\Routing\RedirectDestinationTrait, \Drupal\Core\StringTranslation\StringTranslationTrait
- class \Drupal\Core\Entity\EntityForm implements \Drupal\Core\Entity\EntityFormInterface extends \Drupal\Core\Form\FormBase
- class \Drupal\Core\Entity\ContentEntityForm implements \Drupal\Core\Entity\ContentEntityFormInterface extends \Drupal\Core\Entity\EntityForm
- class \Drupal\aggregator\FeedForm extends \Drupal\Core\Entity\ContentEntityForm
- class \Drupal\Core\Entity\ContentEntityForm implements \Drupal\Core\Entity\ContentEntityFormInterface extends \Drupal\Core\Entity\EntityForm
- class \Drupal\Core\Entity\EntityForm implements \Drupal\Core\Entity\EntityFormInterface extends \Drupal\Core\Form\FormBase
Expanded class hierarchy of FeedForm
File
-
core/
modules/ aggregator/ src/ FeedForm.php, line 15
Namespace
Drupal\aggregatorView source
class FeedForm extends ContentEntityForm {
/**
* {@inheritdoc}
*/
public function save(array $form, FormStateInterface $form_state) {
$feed = $this->entity;
$status = $feed->save();
$label = $feed->label();
$view_link = $feed->toLink($label, 'canonical')
->toString();
if ($status == SAVED_UPDATED) {
$this->messenger()
->addStatus($this->t('The feed %feed has been updated.', [
'%feed' => $view_link,
]));
$form_state->setRedirectUrl($feed->toUrl('canonical'));
}
else {
$this->logger('aggregator')
->notice('Feed %feed added.', [
'%feed' => $feed->label(),
'link' => Link::fromTextAndUrl($this->t('View'), new Url('aggregator.admin_overview'))
->toString(),
]);
$this->messenger()
->addStatus($this->t('The feed %feed has been added.', [
'%feed' => $view_link,
]));
}
}
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.