You are here

protected function LingotekSettingsTabProfilesForm::retrieveUsage in Lingotek Translation 8.2

Same name and namespace in other branches
  1. 8 src/Form/LingotekSettingsTabProfilesForm.php \Drupal\lingotek\Form\LingotekSettingsTabProfilesForm::retrieveUsage()
1 call to LingotekSettingsTabProfilesForm::retrieveUsage()
LingotekSettingsTabProfilesForm::buildForm in src/Form/LingotekSettingsTabProfilesForm.php
Form constructor.

File

src/Form/LingotekSettingsTabProfilesForm.php, line 72

Class

LingotekSettingsTabProfilesForm
Configure Lingotek

Namespace

Drupal\lingotek\Form

Code

protected function retrieveUsage($profile) {
  $usage = 0;
  $entity_types = $this->lingotek
    ->get('translate.entity');

  // Count how many content types are using this $profile
  if (!empty($entity_types)) {
    foreach ($entity_types as $entity_id => $bundles) {
      foreach ($bundles as $bundle) {
        $profile_choice = $bundle['profile'];
        if ($profile_choice == $profile['id']) {
          $usage++;
        }
      }
    }
  }
  return $usage;
}