function Block::setWeight

Same name and namespace in other branches
  1. 9 core/modules/block/src/Entity/Block.php \Drupal\block\Entity\Block::setWeight()
  2. 8.9.x core/modules/block/src/Entity/Block.php \Drupal\block\Entity\Block::setWeight()
  3. 10 core/modules/block/src/Entity/Block.php \Drupal\block\Entity\Block::setWeight()

Attributes

#[ActionMethod(adminLabel: new TranslatableMarkup('Set block weight'), pluralize: FALSE)]

Parameters

int $weight: The desired weight.

Return value

$this

Overrides BlockInterface::setWeight

1 call to Block::setWeight()
Block::preSave in core/modules/block/src/Entity/Block.php
Acts on an entity before the presave hook is invoked.

File

core/modules/block/src/Entity/Block.php, line 330

Class

Block
Defines a Block configuration entity class.

Namespace

Drupal\block\Entity

Code

public function setWeight($weight) {
  $this->weight = (int) $weight;
  return $this;
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.