summaryrefslogtreecommitdiffstatshomepage
path: root/core/modules/node/src/Plugin/Action/DemoteNode.php
blob: d3de76dfcce80e05e1b11d2896780c9fb4939506 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
<?php

namespace Drupal\node\Plugin\Action;

use Drupal\Core\Action\Attribute\Action;
use Drupal\Core\Field\FieldUpdateActionBase;
use Drupal\Core\StringTranslation\TranslatableMarkup;
use Drupal\node\NodeInterface;

/**
 * Demotes a node.
 */
#[Action(
  id: 'node_unpromote_action',
  label: new TranslatableMarkup('Demote selected content from front page'),
  type: 'node'
)]
class DemoteNode extends FieldUpdateActionBase {

  /**
   * {@inheritdoc}
   */
  protected function getFieldsToUpdate() {
    return ['promote' => NodeInterface::NOT_PROMOTED];
  }

}