ShortcutController.php 1.17 KB
Newer Older
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52
<?php
/**
 * @file
 * Contains \Drupal\shortcut\Controller\ShortCutController.
 */

namespace Drupal\shortcut\Controller;

use Drupal\Core\ControllerInterface;
use Drupal\Core\Entity\EntityManager;
use Symfony\Component\DependencyInjection\ContainerInterface;

/**
 * Builds the page for administering shortcut sets.
 */
class ShortcutController implements ControllerInterface {

  /**
   * Stores the entity manager.
   *
   * @var \Drupal\Core\Entity\EntityManager
   */
  protected $entityManager;

  /**
   * Constructs a new \Drupal\shortcut\Controller\ShortCutController object.
   *
   * @param \Drupal\Core\Entity\EntityManager $entity_manager
   *   The entity manager.
   */
   public function __construct(EntityManager $entity_manager) {
     $this->entityManager = $entity_manager;
   }

  /**
   * {@inheritdoc}
   */
  public static function create(ContainerInterface $container) {
    return new static($container->get('plugin.manager.entity'));
  }

  /**
   * Presents a list of layouts.
   *
   * @return array
   *   An array as expected by drupal_render().
   */
  public function shortcutSetAdmin() {
    return $this->entityManager->getListController('shortcut')->render();
  }

}