You are here

private function EntityReference::getAutocompleteSuggestions in Conditional Fields 4.x

Same name and namespace in other branches
  1. 8 src/Plugin/conditional_fields/handler/EntityReference.php \Drupal\conditional_fields\Plugin\conditional_fields\handler\EntityReference::getAutocompleteSuggestions()

Get a variants of node title for autocomplete.

Parameters

\Drupal\node\Entity\Node $node: A node object.

Return value

array An array with a few relevant suggestions for autocomplete.

1 call to EntityReference::getAutocompleteSuggestions()
EntityReference::statesHandler in src/Plugin/conditional_fields/handler/EntityReference.php
Executes states handler according to conditional fields settings.

File

src/Plugin/conditional_fields/handler/EntityReference.php, line 66

Class

EntityReference
Provides states handler for entity reference fields.

Namespace

Drupal\conditional_fields\Plugin\conditional_fields\handler

Code

private function getAutocompleteSuggestions(Node $node) {

  /** @var \Drupal\node\Entity\Node $node */
  return [
    // Node title (nid).
    [
      'value' => $node
        ->label() . ' (' . $node
        ->id() . ')',
    ],
    // Node title.
    [
      'value' => $node
        ->label(),
    ],
  ];
}