EpalStudentCourseFieldListBuilder.php 1.58 KB
Newer Older
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22
<?php

namespace Drupal\epal;

use Drupal\Core\Entity\EntityInterface;
use Drupal\Core\Entity\EntityListBuilder;
use Drupal\Core\Routing\LinkGeneratorTrait;
use Drupal\Core\Url;

/**
 * Defines a class to build a listing of Epal student course field entities.
 *
 * @ingroup epal
 */
class EpalStudentCourseFieldListBuilder extends EntityListBuilder {

  use LinkGeneratorTrait;

  /**
   * {@inheritdoc}
   */
  public function buildHeader() {
23 24 25
    $header['id'] = $this->t('ID');
    $header['name'] = $this->t('Όνομα');
    $header['student_id'] = $this->t('ID Μαθητή');
26
    $header['coursefield_id'] = $this->t('ID Ειδικότητας');        
27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43
    return $header + parent::buildHeader();
  }

  /**
   * {@inheritdoc}
   */
  public function buildRow(EntityInterface $entity) {
    /* @var $entity \Drupal\epal\Entity\EpalStudentCourseField */
    $row['id'] = $entity->id();
    $row['name'] = $this->l(
      $entity->label(),
      new Url(
        'entity.epal_student_course_field.edit_form', array(
          'epal_student_course_field' => $entity->id(),
        )
      )
    );
44 45 46 47 48 49 50 51
    $row['student_id'] = $this->l(
      $entity->getStudent_id(),
      new Url(
        'entity.epal_student_course_field.edit_form', array(
          'epal_student_course_field' => $entity->id(),
        )
      )
    );
52
    $row['coursefield_id'] = $this->l(
53 54 55 56 57 58 59 60
      $entity->getCourseField_id(),
      new Url(
        'entity.epal_student_course_field.edit_form', array(
          'epal_student_course_field' => $entity->id(),
        )
      )
    );

61 62 63 64
    return $row + parent::buildRow($entity);
  }

}