You are here

class MessageUiContextualLinkDeleteMessage in Message UI 8

Contextual link to view the message.

Plugin annotation


@MessageUiViewsContextualLinks(
 id = "delete",
 label = @Translation("Button the delete a message."),
 weight = 2
)

Hierarchy

Expanded class hierarchy of MessageUiContextualLinkDeleteMessage

File

src/Plugin/MessageUiViewsContextualLinks/MessageUiContextualLinkDeleteMessage.php, line 21

Namespace

Drupal\message_ui\Plugin\MessageUiViewsContextualLinks
View source
class MessageUiContextualLinkDeleteMessage extends MessageUiViewsContextualLinksBase implements MessageUiViewsContextualLinksInterface, ContainerFactoryPluginInterface {

  /**
   * Drupal\Core\Entity\EntityTypeManagerInterface definition.
   *
   * @var \Drupal\Core\Entity\EntityTypeManagerInterface
   */
  protected $entityTypeManager;

  /**
   * Construct.
   *
   * @param array $configuration
   *   A configuration array containing information about the plugin instance.
   * @param string $plugin_id
   *   The plugin_id for the plugin instance.
   * @param string $plugin_definition
   *   The plugin implementation definition.
   * @param \Drupal\Core\Entity\EntityTypeManagerInterface $entity_type_manager
   *   The entity type manager service.
   */
  public function __construct(array $configuration, $plugin_id, $plugin_definition, EntityTypeManagerInterface $entity_type_manager) {
    parent::__construct($configuration, $plugin_id, $plugin_definition);
    $this->entityTypeManager = $entity_type_manager;
  }

  /**
   * {@inheritdoc}
   */
  public static function create(ContainerInterface $container, array $configuration, $plugin_id, $plugin_definition) {
    return new static($configuration, $plugin_id, $plugin_definition, $container
      ->get('entity_type.manager'));
  }

  /**
   * {@inheritdoc}
   */
  public function access() {
    return $this->message
      ->access('delete');
  }

  /**
   * {@inheritdoc}
   */
  public function getRouterInfo() {
    return [
      'title' => t('Delete'),
      'url' => Url::fromRoute('entity.message.delete_form', [
        'message' => $this->message
          ->id(),
      ]),
    ];
  }

}

Members

Namesort descending Modifiers Type Description Overrides
MessageUiContextualLinkDeleteMessage::$entityTypeManager protected property Drupal\Core\Entity\EntityTypeManagerInterface definition.
MessageUiContextualLinkDeleteMessage::access public function Checking if the user have access to do the action. Overrides MessageUiViewsContextualLinksInterface::access
MessageUiContextualLinkDeleteMessage::create public static function Creates an instance of the plugin. Overrides ContainerFactoryPluginInterface::create
MessageUiContextualLinkDeleteMessage::getRouterInfo public function Return the an array with the router ID and message info. Overrides MessageUiViewsContextualLinksInterface::getRouterInfo
MessageUiContextualLinkDeleteMessage::__construct public function Construct. Overrides PluginBase::__construct
MessageUiViewsContextualLinksBase::$message protected property The message object.
MessageUiViewsContextualLinksBase::getMessage public function Get te message object. Overrides MessageUiViewsContextualLinksInterface::getMessage
MessageUiViewsContextualLinksBase::setMessage public function Set the message object. Overrides MessageUiViewsContextualLinksInterface::setMessage
PluginBase::$configuration protected property Configuration information passed into the plugin. 1
PluginBase::$pluginDefinition protected property The plugin implementation definition. 1
PluginBase::$pluginId protected property The plugin_id.
PluginBase::DERIVATIVE_SEPARATOR constant A string which is used to separate base plugin IDs from the derivative ID.
PluginBase::getBaseId public function Gets the base_plugin_id of the plugin instance. Overrides DerivativeInspectionInterface::getBaseId
PluginBase::getDerivativeId public function Gets the derivative_id of the plugin instance. Overrides DerivativeInspectionInterface::getDerivativeId
PluginBase::getPluginDefinition public function Gets the definition of the plugin implementation. Overrides PluginInspectionInterface::getPluginDefinition 3
PluginBase::getPluginId public function Gets the plugin_id of the plugin instance. Overrides PluginInspectionInterface::getPluginId
PluginBase::isConfigurable public function Determines if the plugin is configurable.