You are here

public function OpignoModuleManagerController::getNonH5PDescription in Opigno module 8

Same name and namespace in other branches
  1. 3.x src/Controller/OpignoModuleManagerController.php \Drupal\opigno_module\Controller\OpignoModuleManagerController::getNonH5PDescription()

Returns non H5P description.

Parameters

\Drupal\opigno_module\Entity\OpignoActivityType $activity: Activity.

Return value

null|string Non H5P description.

1 call to OpignoModuleManagerController::getNonH5PDescription()
OpignoModuleManagerController::getActivityTypes in src/Controller/OpignoModuleManagerController.php
Get the list of the existing activity types.

File

src/Controller/OpignoModuleManagerController.php, line 389

Class

OpignoModuleManagerController
Controller for all the actions of the Opigno module manager.

Namespace

Drupal\opigno_module\Controller

Code

public function getNonH5PDescription(OpignoActivityType $activity) {
  $html = NULL;
  $html .= '<p class="summary">' . $activity
    ->getSummary() . '</p>';
  $html .= '<p class="description">' . $activity
    ->getDescription() . '</p>';
  if ($image_id = $activity
    ->getImageId()) {
    if ($image = File::load($image_id)) {
      $image_url = ImageStyle::load('large')
        ->buildUrl($image
        ->getFileUri());
      $html .= '<p class="images">';
      $html .= '<img src="' . $image_url . '" alt="" />';
      $html .= '</p>';
    }
  }
  return $html;
}