You are here

protected function ParserOperationForm::initializeOperation in Markdown 8.2

Initializes the operation.

Parameters

\Drupal\markdown\Plugin\Markdown\ParserInterface $parser: The parser being operated on.

string $operation: The operation to perform.

2 calls to ParserOperationForm::initializeOperation()
ParserOperationForm::buildForm in src/Form/ParserOperationForm.php
Form constructor.
ParserOperationForm::executeOperation in src/Form/ParserOperationForm.php
Controller for the "markdown.parser.operation" route.

File

src/Form/ParserOperationForm.php, line 173

Class

ParserOperationForm
Provides a confirmation form to disable a parser.

Namespace

Drupal\markdown\Form

Code

protected function initializeOperation(ParserInterface $parser, $operation) {
  $this->operation = $operation;
  $this->parser = $parser;
  $this->variables = [
    '@action' => substr($this->operation, -1, 1) === 'e' ? $this
      ->t($this->operation . 'd') : $this->operation . 'ed',
    '@operation' => $this->operation,
    '%parser' => $this->parser
      ->getLabel(FALSE),
    '@parser_id' => $this->parser
      ->getPluginId(),
  ];
  $converter = new CamelCaseToSnakeCaseNameConverter();
  $method = $converter
    ->denormalize("operation_{$operation}");
  if (!method_exists($this, $method)) {
    throw new NotFoundHttpException();
  }
  $this->operationMethod = [
    $this,
    $method,
  ];
}