Same name and namespace in other branches
  1. 8.9.x core/modules/block/src/BlockForm.php \Drupal\block\BlockForm::getUniqueMachineName()
  2. 9 core/modules/block/src/BlockForm.php \Drupal\block\BlockForm::getUniqueMachineName()

Generates a unique machine name for a block based on a suggested string.

Parameters

\Drupal\block\BlockInterface $block: The block entity.

Return value

string Returns the unique name.

1 call to BlockForm::getUniqueMachineName()
BlockForm::form in core/modules/block/src/BlockForm.php
Gets the actual form array to be built.

File

core/modules/block/src/BlockForm.php, line 405

Class

BlockForm
Provides form for block instance forms.

Namespace

Drupal\block

Code

public function getUniqueMachineName(BlockInterface $block) {
  $suggestion = $block
    ->getPlugin()
    ->getMachineNameSuggestion();
  return $this->blockRepository
    ->getUniqueMachineName($suggestion, $block
    ->getTheme());
}