You are here

class DevelGeneratePermissions in Devel 8

Same name and namespace in other branches
  1. 8.3 devel_generate/src/DevelGeneratePermissions.php \Drupal\devel_generate\DevelGeneratePermissions
  2. 8.2 devel_generate/src/DevelGeneratePermissions.php \Drupal\devel_generate\DevelGeneratePermissions
  3. 4.x devel_generate/src/DevelGeneratePermissions.php \Drupal\devel_generate\DevelGeneratePermissions

Provides dynamic permissions of the filter module.

Hierarchy

Expanded class hierarchy of DevelGeneratePermissions

File

devel_generate/src/DevelGeneratePermissions.php, line 11

Namespace

Drupal\devel_generate
View source
class DevelGeneratePermissions implements ContainerInjectionInterface {

  /**
   * The plugin manager.
   *
   * @var \Drupal\devel_generate\DevelGeneratePluginManager;
   */
  protected $develGeneratePluginManager;

  /**
   * Constructs a new DevelGeneratePermissions instance.
   *
   * @param \Drupal\devel_generate\DevelGeneratePluginManager $develGeneratePluginManager
   *   The plugin manager.
   */
  public function __construct(DevelGeneratePluginManager $develGeneratePluginManager) {
    $this->develGeneratePluginManager = $develGeneratePluginManager;
  }

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

  /*
   * A permissions callback.
   *
   * @see devel_generate.permissions.yml.
   *
   * @return array
   */
  function permissions() {
    $devel_generate_plugins = $this->develGeneratePluginManager
      ->getDefinitions();
    foreach ($devel_generate_plugins as $plugin) {
      $permission = $plugin['permission'];
      $permissions[$permission] = array(
        'title' => t($permission),
      );
    }

    //    $permissions = array(
    //      'administer devel_generate' => array(
    //        'title' => t('Administer devel generate'),
    //      ),
    //    );
    return $permissions;
  }

}

Members

Namesort descending Modifiers Type Description Overrides
DevelGeneratePermissions::$develGeneratePluginManager protected property The plugin manager.
DevelGeneratePermissions::create public static function Instantiates a new instance of this class. Overrides ContainerInjectionInterface::create
DevelGeneratePermissions::permissions function
DevelGeneratePermissions::__construct public function Constructs a new DevelGeneratePermissions instance.