You are here

public function ModifierIndex::indexModifiers in Persistent URL 8

2 calls to ModifierIndex::indexModifiers()
ModifierIndex::performDueRebuilds in src/Plugin/ModifierIndex.php
ModifierIndex::rebuild in src/Plugin/ModifierIndex.php

File

src/Plugin/ModifierIndex.php, line 31

Class

ModifierIndex

Namespace

Drupal\purl\Plugin

Code

public function indexModifiers(ProviderInterface $provider, $method) {
  $id = $provider
    ->getId();
  $modifiers = $provider
    ->getModifiers();
  if (!is_array($modifiers)) {
    return;
  }
  $this
    ->deleteEntriesByProvider($provider
    ->getId());
  foreach ($modifiers as $modifier => $value) {
    $this->connection
      ->insert('purl_modifiers')
      ->fields(array(
      'modifier' => $modifier,
      'provider' => $id,
      'value' => serialize($value),
    ))
      ->execute();
  }
  $this->connection
    ->update('purl_providers_settings')
    ->condition('provider', $provider
    ->getId())
    ->fields(array(
    'rebuild' => 0,
  ))
    ->execute();
}