You are here

public static function OpignoGroupManagerController::getDefaultBundleImageUrl in Opigno group manager 3.x

Same name and namespace in other branches
  1. 8 src/Controller/OpignoGroupManagerController.php \Drupal\opigno_group_manager\Controller\OpignoGroupManagerController::getDefaultBundleImageUrl()

Returns default image url.

Parameters

string $bundle:

Return value

string

1 call to OpignoGroupManagerController::getDefaultBundleImageUrl()
OpignoGroupManagerController::ajaxFormEntityCallback in src/Controller/OpignoGroupManagerController.php
Form ajax callback.

File

src/Controller/OpignoGroupManagerController.php, line 1950

Class

OpignoGroupManagerController
Controller for all the actions of the Opigno group manager app.

Namespace

Drupal\opigno_group_manager\Controller

Code

public static function getDefaultBundleImageUrl($bundle) {
  switch ($bundle) {
    case 'opigno_course':
      $module = 'opigno_course';
      $image = 'img_course.svg';
      break;
    default:
      $module = 'opigno_module';
      $image = 'img_module.svg';
      break;
  }
  $request = \Drupal::request();
  $path = \Drupal::service('module_handler')
    ->getModule($module)
    ->getPath();
  return $request
    ->getBasePath() . '/' . $path . '/img/' . $image;
}