function BlockForm::getUniqueMachineName

Same name in other branches
  1. 9 core/modules/block/src/BlockForm.php \Drupal\block\BlockForm::getUniqueMachineName()
  2. 8.9.x core/modules/block/src/BlockForm.php \Drupal\block\BlockForm::getUniqueMachineName()
  3. 11.x 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());
}

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