You are here

protected static function MarkdownStatesTrait::getSatesSelector in Markdown 3.0.x

Retrieves a states selector to use based on the form/render array parents.

This is really only useful if using the States API (or something similar)

Parameters

array $parents: The parents of the element.

string $name: Optional. The setting name to append to the selector.

Return value

string The selector path of the extension.

3 calls to MarkdownStatesTrait::getSatesSelector()
AtAutolinker::settingsForm in src/Plugin/Markdown/Extension/AtAutolinker.php
Returns the configuration form elements specific to this plugin.
HashAutolinker::settingsForm in src/Plugin/Markdown/Extension/HashAutolinker.php
Returns the configuration form elements specific to this plugin.
Markdown::settingsForm in src/Plugin/Filter/Markdown.php
@todo Refactor before release.

File

src/Traits/MarkdownStatesTrait.php, line 37

Class

MarkdownStatesTrait

Namespace

Drupal\markdown\Traits

Code

protected static function getSatesSelector(array $parents = [], $name = '') {
  if (isset($name)) {
    $parents[] = $name;
  }
  $selector = array_shift($parents);
  if ($parents) {
    $selector .= '[' . implode('][', $parents) . ']';
  }
  return $selector ? ':input[name="' . $selector . '"]' : '';
}