I became impatient waiting for a comprehensive example of creating a Content Entity with bundles, so I decided to refactor the Drupal 8 Node module as a custom Content Entity. However, I'll use the Node module as reference for my questions pertaining to Actions and Action plugins.

My main question is, how and when are Action plugins called?

I'll use StickyNode as an example.

The StickyNode plugin is defined as such:

<?php
/**
 * @file
 * Contains \Drupal\node\Plugin\Action\StickyNode.
 */

namespace Drupal\node\Plugin\Action;

use

Drupal\Core\Action\ActionBase;

/**
 * Makes a node sticky.
 *
 * @Action(
 *   id = "node_make_sticky_action",
 *   label = @Translation("Make selected content sticky"),
 *   type = "node"
 * )
 */
class StickyNode extends ActionBase {

 

/**
   * {@inheritdoc}
   */
 
public function execute($entity = NULL) {
   
$entity->status = NODE_PUBLISHED;
   
$entity->sticky = NODE_STICKY;
   
$entity->save();
  }

}

?>

And in node/config/install/system.action.node_make_sticky_action.yml, node_make_sticky_action is defined:

id: node_make_sticky_action
label: 'Make content sticky'
status: true
langcode: en
type: node
plugin: node_make_sticky_action
dependencies:
  module:
    - node

Some clarification would be greatly appreciated.