public function LingotekProfileUsage::isUsedByContentSettings in Lingotek Translation 3.2.x
Same name and namespace in other branches
- 8 src/LingotekProfileUsage.php \Drupal\lingotek\LingotekProfileUsage::isUsedByContentSettings()
- 8.2 src/LingotekProfileUsage.php \Drupal\lingotek\LingotekProfileUsage::isUsedByContentSettings()
- 4.0.x src/LingotekProfileUsage.php \Drupal\lingotek\LingotekProfileUsage::isUsedByContentSettings()
- 3.0.x src/LingotekProfileUsage.php \Drupal\lingotek\LingotekProfileUsage::isUsedByContentSettings()
- 3.1.x src/LingotekProfileUsage.php \Drupal\lingotek\LingotekProfileUsage::isUsedByContentSettings()
- 3.3.x src/LingotekProfileUsage.php \Drupal\lingotek\LingotekProfileUsage::isUsedByContentSettings()
- 3.4.x src/LingotekProfileUsage.php \Drupal\lingotek\LingotekProfileUsage::isUsedByContentSettings()
- 3.5.x src/LingotekProfileUsage.php \Drupal\lingotek\LingotekProfileUsage::isUsedByContentSettings()
- 3.6.x src/LingotekProfileUsage.php \Drupal\lingotek\LingotekProfileUsage::isUsedByContentSettings()
- 3.7.x src/LingotekProfileUsage.php \Drupal\lingotek\LingotekProfileUsage::isUsedByContentSettings()
- 3.8.x src/LingotekProfileUsage.php \Drupal\lingotek\LingotekProfileUsage::isUsedByContentSettings()
Check if a profile is configured to be used by content entities.
Parameters
\Drupal\lingotek\LingotekProfileInterface $profile: The profile being checked.
Return value
int Bitwise flag. Can include LingotekProfileUsageInterface::USED_BY_SETTINGS or LingotekProfileUsageInterface::UNUSED.
Overrides LingotekProfileUsageInterface::isUsedByContentSettings
File
- src/
LingotekProfileUsage.php, line 99
Class
- LingotekProfileUsage
- Service for checking Lingotek profiles usage.
Namespace
Drupal\lingotekCode
public function isUsedByContentSettings(LingotekProfileInterface $profile) {
$entity_types = $this->lingotekConfiguration
->getEnabledEntityTypes();
$used = LingotekProfileUsageInterface::UNUSED;
foreach ($entity_types as $entity_type_id => $entity_type_definition) {
$bundles = $this->entityTypeBundleInfo
->getBundleInfo($entity_type_id);
foreach ($bundles as $bundle_id => $bundle_definition) {
$config_profile = $this->lingotekConfiguration
->getDefaultProfileId($entity_type_id, $bundle_id);
if ($config_profile === $profile
->id()) {
$used |= LingotekProfileUsageInterface::USED_BY_SETTINGS;
}
}
}
return $used;
}