function hook_lingotek_content_entity_get_profile in Lingotek Translation 3.4.x
Same name and namespace in other branches
- 8.2 lingotek.api.php \hook_lingotek_content_entity_get_profile()
- 4.0.x lingotek.api.php \hook_lingotek_content_entity_get_profile()
- 3.0.x lingotek.api.php \hook_lingotek_content_entity_get_profile()
- 3.1.x lingotek.api.php \hook_lingotek_content_entity_get_profile()
- 3.2.x lingotek.api.php \hook_lingotek_content_entity_get_profile()
- 3.3.x lingotek.api.php \hook_lingotek_content_entity_get_profile()
- 3.5.x lingotek.api.php \hook_lingotek_content_entity_get_profile()
- 3.6.x lingotek.api.php \hook_lingotek_content_entity_get_profile()
- 3.7.x lingotek.api.php \hook_lingotek_content_entity_get_profile()
- 3.8.x lingotek.api.php \hook_lingotek_content_entity_get_profile()
Determines the default Lingotek profile for the given entity.
@returns \Drupal\lingotek\LingotekProfileInterface The default profile.
Parameters
\Drupal\Core\Entity\ContentEntityInterface $entity: The entity.
\Drupal\lingotek\LingotekProfileInterface &$profile: The already calculated profile.
bool $provide_default: If TRUE, and the entity does not have a profile, will retrieve the default for this entity type and bundle. Defaults to TRUE.
1 function implements hook_lingotek_content_entity_get_profile()
Note: this list is generated by pattern matching, so it may include some functions that are not actually implementations of this hook.
- lingotek_test_lingotek_content_entity_get_profile in tests/
modules/ lingotek_test/ lingotek_test.module - Implements hook_lingotek_content_entity_get_profile().
1 invocation of hook_lingotek_content_entity_get_profile()
- LingotekConfigurationService::getEntityProfile in src/
LingotekConfigurationService.php - Determines the default Lingotek profile for the given entity.
File
- ./
lingotek.api.php, line 85 - Hooks provided by the Lingotek module.
Code
function hook_lingotek_content_entity_get_profile(ContentEntityInterface $entity, LingotekProfileInterface &$profile = NULL, $provide_default = TRUE) {
/*
* If the document being uploaded is a comment, use the profile from the
* commented entity.
*/
if ($entity
->getEntityTypeId() === 'comment') {
/** @var \Drupal\comment\CommentInterface $entity */
$commented = $entity
->getCommentedEntity();
/** @var \Drupal\lingotek\LingotekConfigurationServiceInterface $lingotek_config */
$lingotek_config = \Drupal::service('lingotek.configuration');
$profile = $lingotek_config
->getEntityProfile($commented, FALSE);
}
}