You are here

interface FieldPermissionTypeInterface in Field Permissions 8.2

Same name and namespace in other branches
  1. 8 src/Plugin/FieldPermissionTypeInterface.php \Drupal\field_permissions\Plugin\FieldPermissionTypeInterface

A field permission type plugin interface.

Hierarchy

Expanded class hierarchy of FieldPermissionTypeInterface

All classes that implement FieldPermissionTypeInterface

12 files declare their use of FieldPermissionTypeInterface
Base.php in src/Plugin/FieldPermissionType/Base.php
FieldPermissionsCommentTest.php in tests/src/Functional/FieldPermissionsCommentTest.php
FieldPermissionsController.php in src/Controller/FieldPermissionsController.php
FieldPermissionSettings.php in src/Plugin/migrate/process/FieldPermissionSettings.php
FieldPermissionsNodeTest.php in tests/src/Functional/FieldPermissionsNodeTest.php

... See full list

File

src/Plugin/FieldPermissionTypeInterface.php, line 13

Namespace

Drupal\field_permissions\Plugin
View source
interface FieldPermissionTypeInterface extends PluginInspectionInterface, DerivativeInspectionInterface {

  /**
   * Indicates that a field does not have field-specific access control.
   *
   * Public field access is not implemented as a plugin because it effectively
   * means this module does not process any access control for fields with this
   * type of permission.
   */
  const ACCESS_PUBLIC = 'public';

  /**
   * Indicates that a field is using the private access permission type.
   *
   * Private fields are never displayed, and are only editable by the author
   * (and by site administrators with the 'access private fields' permission).
   *
   * @internal
   *
   * This is here as a helper since there are still special handling of the
   * various plugins throughout this module.
   *
   * @see \Drupal\field_permissions\Plugin\FieldPermissionType\PrivateAccess
   */
  const ACCESS_PRIVATE = 'private';

  /**
   * Indicates that a field is using the custom permission type.
   *
   * @internal
   *
   * This is here as a helper since there are still special handling of the
   * various plugins throughout this module.
   *
   * @see \Drupal\field_permissions\Plugin\FieldPermissionType\CustomAccess
   */
  const ACCESS_CUSTOM = 'custom';

  /**
   * The permission type label.
   *
   * @return string
   *   The field permission type label.
   */
  public function getLabel();

  /**
   * The permission type description.
   *
   * @return string
   *   The field permission type description.
   */
  public function getDescription();

  /**
   * Determine if access to the field is granted for a given account.
   *
   * @param string $operation
   *   The operation to check. Either 'view' or 'edit'.
   * @param \Drupal\Core\Entity\EntityInterface $entity
   *   The entity the field is attached to.
   * @param \Drupal\Core\Session\AccountInterface $account
   *   The user to check access for.
   *
   * @return bool
   *   The access result.
   */
  public function hasFieldAccess($operation, EntityInterface $entity, AccountInterface $account);

}

Members

Namesort descending Modifiers Type Description Overrides
DerivativeInspectionInterface::getBaseId public function Gets the base_plugin_id of the plugin instance. 1
DerivativeInspectionInterface::getDerivativeId public function Gets the derivative_id of the plugin instance. 1
FieldPermissionTypeInterface::ACCESS_CUSTOM constant Indicates that a field is using the custom permission type.
FieldPermissionTypeInterface::ACCESS_PRIVATE constant Indicates that a field is using the private access permission type.
FieldPermissionTypeInterface::ACCESS_PUBLIC constant Indicates that a field does not have field-specific access control.
FieldPermissionTypeInterface::getDescription public function The permission type description. 1
FieldPermissionTypeInterface::getLabel public function The permission type label. 1
FieldPermissionTypeInterface::hasFieldAccess public function Determine if access to the field is granted for a given account. 3
PluginInspectionInterface::getPluginDefinition public function Gets the definition of the plugin implementation. 4
PluginInspectionInterface::getPluginId public function Gets the plugin_id of the plugin instance. 2