public function ContentTypeModule::getModuleImageUrl in Opigno module 8
Same name and namespace in other branches
- 3.x src/Plugin/OpignoGroupManagerContentType/ContentTypeModule.php \Drupal\opigno_module\Plugin\OpignoGroupManagerContentType\ContentTypeModule::getModuleImageUrl()
Returns module image url.
4 calls to ContentTypeModule::getModuleImageUrl()
- ContentTypeModule::getAllContents in src/
Plugin/ OpignoGroupManagerContentType/ ContentTypeModule.php - Get all the entities in an array of LearningPathContent.
- ContentTypeModule::getAvailableContents in src/
Plugin/ OpignoGroupManagerContentType/ ContentTypeModule.php - Get all the published entities in an array of LearningPathContent.
- ContentTypeModule::getContent in src/
Plugin/ OpignoGroupManagerContentType/ ContentTypeModule.php - Get the entity as a LearningPathContent.
- ContentTypeModule::getContentFromRequest in src/
Plugin/ OpignoGroupManagerContentType/ ContentTypeModule.php - Try to get the content from a Request object.
File
- src/
Plugin/ OpignoGroupManagerContentType/ ContentTypeModule.php, line 290
Class
- ContentTypeModule
- Class ContentTypeModule.
Namespace
Drupal\opigno_module\Plugin\OpignoGroupManagerContentTypeCode
public function getModuleImageUrl($module) {
$image_url = NULL;
if (!$module) {
return $image_url;
}
$media = $module
->get('module_media_image')->entity;
if ($media) {
$image = $media
->get('field_media_image')
->getValue();
}
if (isset($image)) {
$image = File::load($image[0]['target_id']);
$style = ImageStyle::load('learning_path_thumbnail');
if ($style) {
$image_url = $style
->buildUrl($image
->getFileUri());
}
}
return $image_url;
}