You are here

public function RulesComponent::autocomplete in Rules 8.3

Returns autocomplete results for the given partial selector.

Example: "node.uid.e" will return ["node.uid.entity"].

Parameters

string $partial_selector: The partial data selector.

\Drupal\rules\Engine\ExpressionInterface $until: The expression in which the autocompletion will be executed. All variables in the execution metadata state up to that point are available.

Return value

array[] A list of autocomplete suggestions - valid property paths for one of the provided data definitions. Each entry is an array with the following keys:

  • value: the data selecor property path.
  • label: the human readable label suggestion.

File

src/Engine/RulesComponent.php, line 354

Class

RulesComponent
Handles executable Rules components.

Namespace

Drupal\rules\Engine

Code

public function autocomplete($partial_selector, ExpressionInterface $until = NULL) {

  // We use the integrity check to populate the execution metadata state with
  // available variables.
  $metadata_state = $this
    ->getMetadataState();
  $this->expression
    ->prepareExecutionMetadataState($metadata_state, $until);
  return $metadata_state
    ->autocomplete($partial_selector);
}