Skip to content
This repository has been archived by the owner on Mar 24, 2021. It is now read-only.

Commit

Permalink
added route definitions for add/edit
Browse files Browse the repository at this point in the history
  • Loading branch information
wachterjohannes authored and danrot committed Nov 12, 2018
1 parent aca9301 commit eddba7f
Show file tree
Hide file tree
Showing 5 changed files with 58 additions and 3 deletions.
22 changes: 22 additions & 0 deletions Admin/EventAdmin.php
Original file line number Diff line number Diff line change
Expand Up @@ -38,11 +38,33 @@ public function getNavigation(): Navigation

public function getRoutes(): array
{
$formToolbarActions = [
'sulu_admin.save',
'sulu_admin.delete',
];

return [
(new Route('example_event.event_datagrid', '/events', 'sulu_admin.datagrid'))
->addOption('title', 'example_event.events')
->addOption('adapters', ['table'])
->addOption('resourceKey', 'events')
->addOption('addRoute', 'example_event.event_add_form.detail')
->addOption('editRoute', 'example_event.event_edit_form.detail'),
(new Route('example_event.event_add_form', '/events/add', 'sulu_admin.resource_tabs'))
->addOption('toolbarActions', $formToolbarActions)
->addOption('resourceKey', 'events'),
(new Route('example_event.event_add_form.detail', '/details', 'sulu_admin.form'))
->addOption('tabTitle', 'example_event.details')
->addOption('backRoute', 'example_event.event_datagrid')
->addOption('editRoute', 'example_event.event_edit_form.detail')
->setParent('example_event.event_add_form'),
(new Route('example_event.event_edit_form', '/events/:id', 'sulu_admin.resource_tabs'))
->addOption('toolbarActions', $formToolbarActions)
->addOption('resourceKey', 'events'),
(new Route('example_event.event_edit_form.detail', '/details', 'sulu_admin.form'))
->addOption('tabTitle', 'example_event.details')
->addOption('backRoute', 'example_event.event_datagrid')
->setParent('example_event.event_edit_form'),
];
}
}
2 changes: 1 addition & 1 deletion DependencyInjection/ExampleEventExtension.php
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ private function prependAdmin(ContainerBuilder $container)
[
'resources' => [
'events' => [
'form' => [],
'form' => ['@ExampleEventBundle/Resources/config/forms/Event.xml'],
'datagrid' => Event::class,
'endpoint' => 'sulu_example_event.get_events',
],
Expand Down
31 changes: 31 additions & 0 deletions Resources/config/forms/Event.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
<?xml version="1.0" ?>
<form xmlns="http://schemas.sulu.io/template/template"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://schemas.sulu.io/template/template http://schemas.sulu.io/template/form-1.0.xsd">
<properties>
<property name="title" type="text_line" mandatory="true">
<meta>
<title lang="de">Titel</title>
<title lang="en">Title</title>
</meta>
</property>
<property name="description" type="text_area" mandatory="true">
<meta>
<title lang="de">Beschreibung</title>
<title lang="en">Description</title>
</meta>
</property>
<property name="startDate" type="date" colspan="6">
<meta>
<title lang="de">Start</title>
<title lang="en">Start</title>
</meta>
</property>
<property name="endDate" type="date" colspan="6">
<meta>
<title lang="de">Ende</title>
<title lang="en">End</title>
</meta>
</property>
</properties>
</form>
3 changes: 2 additions & 1 deletion Resources/translations/sulu/admin.de.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,6 @@
"example_event.created": "Erstellt am",
"example_event.creator": "Erstellt von",
"example_event.changed": "Bearbeitet am",
"example_event.changer": "Bearbeitet von"
"example_event.changer": "Bearbeitet von",
"example_event.details": "Details"
}
3 changes: 2 additions & 1 deletion Resources/translations/sulu/admin.en.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,6 @@
"example_event.created": "Created at",
"example_event.creator": "Created by",
"example_event.changed": "Changed at",
"example_event.changer": "Changed by"
"example_event.changer": "Changed by",
"example_event.details": "Details"
}

0 comments on commit eddba7f

Please sign in to comment.