-
Angie Byron authored
Issue #2089635 by tim.plunkett, disasm, larowlan: Convert non-test non-form page callbacks to routes and controllers.
Angie Byron authoredIssue #2089635 by tim.plunkett, disasm, larowlan: Convert non-test non-form page callbacks to routes and controllers.
Code owners
Assign users and groups as approvers for specific file changes. Learn more.
AggregatorController.php 12.68 KiB
<?php
/**
* @file
* Contains \Drupal\aggregator\Controller\AggregatorController.
*/
namespace Drupal\aggregator\Controller;
use Drupal\Core\Controller\ControllerBase;
use Drupal\Core\DependencyInjection\ContainerInjectionInterface;
use Drupal\aggregator\CategoryStorageControllerInterface;
use Drupal\aggregator\FeedInterface;
use Drupal\aggregator\ItemInterface;
use Drupal\Core\Database\Connection;
use Symfony\Component\DependencyInjection\ContainerInterface;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpKernel\Exception\AccessDeniedHttpException;
/**
* Returns responses for aggregator module routes.
*/
class AggregatorController extends ControllerBase implements ContainerInjectionInterface {
/**
* The database connection.
*
* @var \Drupal\Core\Database\Connection;
*/
protected $database;
/**
* The category storage controller.
*
* @var \Drupal\aggregator\CategoryStorageControllerInterface
*/
protected $categoryStorage;
/**
* Constructs a \Drupal\aggregator\Controller\AggregatorController object.
*
* @param \Drupal\Core\Database\Connection $database
* The database connection.
* @param \Drupal\aggregator\CategoryStorageControllerInterface $category_storage
* The category storage service.
*/
public function __construct(Connection $database, CategoryStorageControllerInterface $category_storage) {
$this->database = $database;
$this->categoryStorage = $category_storage;
}
/**
* {inheritdoc}
*/
public static function create(ContainerInterface $container) {
return new static(
$container->get('database'),
$container->get('aggregator.category.storage')
);
}
/**
* Presents the aggregator feed creation form.
*
* @return array
* A form array as expected by drupal_render().
*/
public function feedAdd() {
$entity_manager = $this->entityManager();
$feed = $entity_manager->getStorageController('aggregator_feed')