function DraggableListBuilder::getWeight

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

Gets the weight of the given entity.

Parameters

\Drupal\Core\Entity\EntityInterface $entity: The entity to get the weight for.

Return value

int|float The weight of the entity.

Overrides DraggableListBuilderTrait::getWeight

File

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

Class

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

Namespace

Drupal\Core\Config\Entity

Code

protected function getWeight(EntityInterface $entity) : int|float {
    
    /** @var \Drupal\Core\Config\Entity\ConfigEntityInterface $entity */
    return $entity->get($this->weightKey) ?: 0;
}

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