function DraggableListBuilder::setWeight

Same name in other branches
  1. 11.x core/lib/Drupal/Core/Config/Entity/DraggableListBuilder.php \Drupal\Core\Config\Entity\DraggableListBuilder::setWeight()

Overrides DraggableListBuilderTrait::setWeight

File

core/lib/Drupal/Core/Config/Entity/DraggableListBuilder.php, line 45

Class

DraggableListBuilder
Defines a class to build a draggable listing of configuration entities.

Namespace

Drupal\Core\Config\Entity

Code

protected function setWeight(EntityInterface $entity, int|float $weight) : EntityInterface {
    
    /** @var \Drupal\Core\Config\Entity\ConfigEntityInterface $entity */
    $entity->set($this->weightKey, $weight);
    return $entity;
}

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