You are here

function fontyourface_delete in @font-your-face 8.3

Deletes fonts from a specific provider.

Parameters

string $provider: The providing submodule.

7 calls to fontyourface_delete()
adobe_edge_fonts_uninstall in modules/adobe_edge_fonts/adobe_edge_fonts.install
Implements hook_uninstall().
fontscom_api_uninstall in modules/fontscom_api/fontscom_api.install
Implements hook_uninstall().
fontsquirrel_api_uninstall in modules/fontsquirrel_api/fontsquirrel_api.install
Implements hook_uninstall().
google_fonts_api_uninstall in modules/google_fonts_api/google_fonts_api.install
Implements hook_uninstall().
local_fonts_uninstall in modules/local_fonts/local_fonts.install
Implements hook_uninstall().

... See full list

File

./fontyourface.module, line 372
Contains fontyourface.module..

Code

function fontyourface_delete($provider) {

  // Delete fonts, 50 at a time.
  @set_time_limit(3600);
  while (TRUE) {
    $storage_handler = \Drupal::entityTypeManager()
      ->getStorage('font');
    $fids = \Drupal::entityQuery('font')
      ->condition('pid', $provider)
      ->range(0, 50)
      ->execute();
    if (!empty($fids)) {
      $fonts = $storage_handler
        ->loadMultiple(array_keys($fids));
      $storage_handler
        ->delete($fonts);
    }
    else {
      break;
    }
  }
}