You are here

public function CourseCreditCertificateMapper::getMapKeys in Certificate 4.x

Get a list of map keys.

Return value

array

Overrides CertificateMapperBase::getMapKeys

File

src/Plugin/certificate/CertificateMapper/CourseCreditCertificateMapper.php, line 24

Class

CourseCreditCertificateMapper
Plugin annotation @CertificateMapper( id = "course_credit_awarded", label = @Translation("Awarded course credit"), description = @Translation("Using this mapping will award a certificate based on the credit type the user claimed after completing a…

Namespace

Drupal\certificate\Plugin\certificate\CertificateMapper

Code

public function getMapKeys() {
  $options = [];
  $credits = CourseCreditType::loadMultiple();
  $credit_types = Drupal::entityTypeManager()
    ->getStorage('course_credit_type')
    ->loadByProperties([
    'status' => 1,
  ]);
  foreach ($credit_types as $key => $type) {
    $options[$key] = $type
      ->label();
  }
  return $options;
}