You are here

private function AddForm::buildRows in Linkit 8.5

Same name and namespace in other branches
  1. 8.4 src/Form/Matcher/AddForm.php \Drupal\linkit\Form\Matcher\AddForm::buildRows()

Builds the table rows.

Return value

array An array of table rows.

1 call to AddForm::buildRows()
AddForm::buildForm in src/Form/Matcher/AddForm.php
Form constructor.

File

src/Form/Matcher/AddForm.php, line 137

Class

AddForm
Provides a form to apply matchers to a profile.

Namespace

Drupal\linkit\Form\Matcher

Code

private function buildRows() {
  $rows = [];
  $all_plugins = $this->manager
    ->getDefinitions();
  uasort($all_plugins, function ($a, $b) {
    return strnatcasecmp($a['label'], $b['label']);
  });
  foreach ($all_plugins as $definition) {

    /** @var \Drupal\linkit\MatcherInterface $plugin */
    $plugin = $this->manager
      ->createInstance($definition['id']);
    $row = [
      'label' => $plugin
        ->getLabel(),
    ];
    $rows[$plugin
      ->getPluginId()] = $row;
  }
  return $rows;
}