You are here

public function ContentTypeModule::getModuleImageAlt in Opigno module 8

Same name and namespace in other branches
  1. 3.x src/Plugin/OpignoGroupManagerContentType/ContentTypeModule.php \Drupal\opigno_module\Plugin\OpignoGroupManagerContentType\ContentTypeModule::getModuleImageAlt()

Returns module image alt.

4 calls to ContentTypeModule::getModuleImageAlt()
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 279

Class

ContentTypeModule
Class ContentTypeModule.

Namespace

Drupal\opigno_module\Plugin\OpignoGroupManagerContentType

Code

public function getModuleImageAlt($module) {
  $media = $module
    ->get('module_media_image')->entity;
  if ($image = $media
    ->get('field_media_image')
    ->getValue()) {
    return isset($image[0]['alt']) ? $image[0]['alt'] : NULL;
  }
  return NULL;
}