Commit 8859760f authored by New Zeal's avatar New Zeal

Merge branch 'v-admin-content' into 8.x-1.x

parents e29ba159 28b4a53f
......@@ -4,3 +4,8 @@ message_thread.overview_templates:
description: 'Manage message templates.'
route_name: message_thread.overview_templates
message_thread.admin_content:
title: 'Message Threads'
description: 'Display all message threads.'
parent: 'system.admin_content'
route_name: message_thread.message_threads
......@@ -7,14 +7,13 @@ message_thread.overview_templates:
requirements:
_permission: 'administer message thread templates'
#message_thread.thread_add:
# path: '/message/thread/add'
# defaults:
# _entity_form: 'message_thread.add'
# _title: 'Add message thread'
# requirements:
# _permission: 'administer message templates'
message_thread.message_threads:
path: '/admin/content/message-thread'
defaults:
_title: 'Message Threads'
_entity_list: 'message_thread'
requirements:
_permission: 'overview message threads'
message_thread.template_add:
path: '/admin/structure/message-thread/template/add'
......
......@@ -8,6 +8,7 @@ use Drupal\Core\Entity\EntityListBuilder;
use Drupal\Core\Entity\EntityStorageInterface;
use Drupal\Core\Entity\EntityTypeInterface;
use Symfony\Component\DependencyInjection\ContainerInterface;
use Drupal\Core\Url;
/**
* Defines a class to build a listing of Message entities.
......@@ -60,7 +61,7 @@ class MessageThreadListBuilder extends EntityListBuilder {
'data' => $this->t('Created'),
'class' => [RESPONSIVE_PRIORITY_LOW],
],
'text' => $this->t('Text'),
'title' => $this->t('Title'),
'template' => [
'data' => $this->t('Template'),
'class' => [RESPONSIVE_PRIORITY_MEDIUM],
......@@ -69,6 +70,14 @@ class MessageThreadListBuilder extends EntityListBuilder {
'data' => $this->t('Author'),
'class' => [RESPONSIVE_PRIORITY_LOW],
],
'link' => [
'data' => $this->t('View'),
'class' => [RESPONSIVE_PRIORITY_MEDIUM],
],
'edit' => [
'data' => $this->t('Edit'),
'class' => [RESPONSIVE_PRIORITY_MEDIUM],
],
];
if (\Drupal::languageManager()->isMultilingual()) {
......@@ -86,12 +95,31 @@ class MessageThreadListBuilder extends EntityListBuilder {
*/
public function buildRow(EntityInterface $entity) {
$url = Url::fromRoute('entity.message_thread.canonical', ['message_thread' => $entity->id()]);
$attributes = [
'class' => ['reports-back'],
];
$link = [
'#type' => 'link',
'#url' => $url,
'#title' => 'View',
'#attributes' => $attributes,
];
$url = Url::fromRoute('entity.message_thread.edit_form', ['message_thread' => $entity->id()]);
$edit = [
'#type' => 'link',
'#url' => $url,
'#title' => 'Edit',
'#attributes' => $attributes,
];
/** @var Message $entity */
return [
'changed' => $this->dateService->format($entity->getCreatedTime(), 'short'),
// 'title' => $this->get('field_thread_title')->getValue()[0]['value'],
'title' => $entity->get('field_thread_title')->getValue()[0]['value'],
'template' => $entity->getTemplate()->label(),
'author' => $entity->getOwner()->label(),
'link' => render($link),
'edit' => render($edit)
];
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment