public function Mp3playerController::mp3player_player_list in MP3 Player 8
1 string reference to 'Mp3playerController::mp3player_player_list'
File
- src/
Controller/ Mp3playerController.php, line 11
Class
Namespace
Drupal\mp3player\ControllerCode
public function mp3player_player_list() {
$header = array(
t('Player Name'),
t('Actions'),
);
$rows = array();
$players = $this
->mp3player_players();
foreach ($players as $pid => $player) {
$row = array();
$row[] = $player['name'];
$url = Url::fromRoute('mp3player.edit_player', array(
'pid' => $pid,
));
$row[] = \Drupal::l(t('Edit'), $url);
if ($pid > 1) {
$url = Url::fromRoute('mp3player.delete_player', array(
'pid' => $pid,
));
$row[] = \Drupal::l(t('Delete'), $url);
}
$rows[] = $row;
}
$output = array(
'#type' => 'table',
'#header' => $header,
'#rows' => $rows,
);
return $output;
}