PictureMappingListController.php

Contains Drupal\picture\PictureListController.

Namespace

Drupal\picture

File

drupal/core/modules/picture/lib/Drupal/picture/PictureMappingListController.php
View source
<?php

/**
 * @file
 * Contains Drupal\picture\PictureListController.
 */
namespace Drupal\picture;

use Drupal\Core\Config\Entity\ConfigEntityListController;
use Drupal\Core\Entity\EntityInterface;

/**
 * Provides a listing of Pictures.
 */
class PictureMappingListController extends ConfigEntityListController {

  /**
   * Overrides Drupal\config\EntityListControllerBase::hookMenu().
   */
  public function hookMenu() {
    $path = $this->entityInfo['list path'];
    $items = parent::hookMenu();

    // Override the access callback.
    $items[$path]['title'] = 'Picture Mappings';
    $items[$path]['description'] = 'Manage list of picture mappings.';
    $items[$path]['access callback'] = 'user_access';
    $items[$path]['access arguments'] = array(
      'administer pictures',
    );
    return $items;
  }

  /**
   * Overrides Drupal\config\ConfigEntityListController::getOperations();
   */
  public function getOperations(EntityInterface $entity) {
    $operations = parent::getOperations($entity);
    $uri = $entity
      ->uri();
    $operations['duplicate'] = array(
      'title' => t('Duplicate'),
      'href' => $uri['path'] . '/duplicate',
      'options' => $uri['options'],
      'weight' => 15,
    );
    return $operations;
  }

}

Classes

Namesort descending Description
PictureMappingListController Provides a listing of Pictures.