Skip to content
Snippets Groups Projects
Commit 3a503887 authored by dpi's avatar dpi
Browse files

Fixed: errors display when field_ui module is not enabled.

parent 18220536
No related branches found
No related tags found
No related merge requests found
......@@ -58,19 +58,21 @@ class EventTypeListBuilder extends ConfigEntityListBuilder {
/** @var \Drupal\rng\EventTypeInterface $entity **/
$operations = parent::getDefaultOperations($entity);
$entity_type = \Drupal::entityManager()
->getDefinition($entity->getEventEntityTypeId());
if ($entity_type->get('field_ui_base_route')) {
$options = [];
if ($entity_type->getBundleEntityType() !== 'bundle') {
$options[$entity_type->getBundleEntityType()] = $entity->getEventBundle();
if ($this->moduleHandler->moduleExists('field_ui')) {
$entity_type = \Drupal::entityManager()
->getDefinition($entity->getEventEntityTypeId());
if ($entity_type->get('field_ui_base_route')) {
$options = [];
if ($entity_type->getBundleEntityType() !== 'bundle') {
$options[$entity_type->getBundleEntityType()] = $entity->getEventBundle();
}
$operations['manage-fields'] = [
'title' => t('Event setting defaults'),
'weight' => 15,
'url' => Url::fromRoute("entity." . $entity->getEventEntityTypeId() . ".field_ui_fields", $options),
];
}
$operations['manage-fields'] = [
'title' => t('Event setting defaults'),
'weight' => 15,
'url' => Url::fromRoute("entity." . $entity->getEventEntityTypeId() . ".field_ui_fields", $options),
];
}
return $operations;
......
......@@ -19,7 +19,7 @@ use Drupal\Core\Url;
*/
class EventTypeTest extends RNGTestBase {
public static $modules = array('node');
public static $modules = array('node', 'field_ui');
function testEventType() {
$web_user = $this->drupalCreateUser(['administer event types', 'access administration pages']);
......@@ -63,7 +63,9 @@ class EventTypeTest extends RNGTestBase {
// Event type list
$this->assertUrl('admin/config/rng/event_types', [], 'Browser was redirected to event type list.');
$this->assertRaw('<td>node.event</td>', 'Event Type shows in list');
$this->assertRaw('<td>Content: event</td>', 'Event Type shows in list');
$options = ['node_type' => 'event'];
$this->assertLinkByHref(Url::fromRoute("entity.node.field_ui_fields", $options)->toString());
// Edit form
$edit = [];
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment