mirror of
https://github.com/flextype/flextype.git
synced 2025-08-28 23:40:41 +02:00
@@ -41,7 +41,7 @@ class EntriesController extends Controller
|
||||
|
||||
// Set Entries ID in parts
|
||||
if (isset($query['id'])) {
|
||||
$parts = explode("/", $query);
|
||||
$parts = explode("/", $query['id']);
|
||||
} else {
|
||||
$parts = [0 => ''];
|
||||
}
|
||||
@@ -532,21 +532,22 @@ class EntriesController extends Controller
|
||||
|
||||
public function edit(Request $request, Response $response)
|
||||
{
|
||||
// Get Entry ID
|
||||
$id = $request->getQueryParams()['id'];
|
||||
$_id = $id;
|
||||
|
||||
if ($_id == null) {
|
||||
$_id = [0 => ''];
|
||||
// Get Query Params
|
||||
$query = $request->getQueryParams();
|
||||
|
||||
// Set Entries ID in parts
|
||||
if (isset($query['id'])) {
|
||||
$parts = explode("/", $query['id']);
|
||||
} else {
|
||||
$_id = explode("/", $id);
|
||||
$parts = [0 => ''];
|
||||
}
|
||||
|
||||
// Get Entry type
|
||||
$type = $request->getQueryParams()['type'];
|
||||
|
||||
// Get Entry
|
||||
$entry = $this->entries->fetch($id);
|
||||
$entry = $this->entries->fetch($this->getEntryID($query));
|
||||
|
||||
// Fieldsets for current entry template
|
||||
$fieldsets_path = PATH['site'] . '/fieldsets/' . (isset($entry['fieldset']) ? $entry['fieldset'] : 'default') . '.json';
|
||||
@@ -558,26 +559,26 @@ class EntriesController extends Controller
|
||||
$response,
|
||||
'plugins/admin/views/templates/content/entries/source.html',
|
||||
[
|
||||
'parts' => $_id,
|
||||
'i' => count($_id),
|
||||
'last' => Arr::last($_id),
|
||||
'id' => $id,
|
||||
'parts' => $parts,
|
||||
'i' => count($parts),
|
||||
'last' => Arr::last($parts),
|
||||
'id' => $this->getEntryID($query),
|
||||
'data' => JsonParser::encode($entry),
|
||||
'type' => $type,
|
||||
'menu_item' => 'entries',
|
||||
'links' => [
|
||||
'edit_entry' => [
|
||||
'link' => $this->router->pathFor('admin.entries.edit') . '?id=' . $id,
|
||||
'link' => $this->router->pathFor('admin.entries.edit') . '?id=' . $this->getEntryID($query). '&type=editor',
|
||||
'title' => __('admin_content'),
|
||||
'attributes' => ['class' => 'navbar-item']
|
||||
],
|
||||
'edit_entry_media' => [
|
||||
'link' => $this->router->pathFor('admin.entries.edit') . '?id=' . $id . '&type=media',
|
||||
'link' => $this->router->pathFor('admin.entries.edit') . '?id=' . $this->getEntryID($query) . '&type=media',
|
||||
'title' => __('admin_media'),
|
||||
'attributes' => ['class' => 'navbar-item']
|
||||
],
|
||||
'edit_entry_source' => [
|
||||
'link' => $this->router->pathFor('admin.entries.edit') . '?id=' . $id . '&type=source',
|
||||
'link' => $this->router->pathFor('admin.entries.edit') . '?id=' . $this->getEntryID($query) . '&type=source',
|
||||
'title' => __('admin_source'),
|
||||
'attributes' => ['class' => 'navbar-item active']
|
||||
],
|
||||
@@ -596,27 +597,25 @@ class EntriesController extends Controller
|
||||
$response,
|
||||
'plugins/admin/views/templates/content/entries/media.html',
|
||||
[
|
||||
'parts' => $_id,
|
||||
'i' => count($_id),
|
||||
'last' => Arr::last($_id),
|
||||
|
||||
'id' => $id,
|
||||
'files' => $this->getMediaList($id, true),
|
||||
|
||||
'parts' => $parts,
|
||||
'i' => count($parts),
|
||||
'last' => Arr::last($parts),
|
||||
'id' => $this->getEntryID($query),
|
||||
'files' => $this->getMediaList($this->getEntryID($query), true),
|
||||
'menu_item' => 'entries',
|
||||
'links' => [
|
||||
'edit_entry' => [
|
||||
'link' => $this->router->pathFor('admin.entries.edit') . '?id=' . $id,
|
||||
'link' => $this->router->pathFor('admin.entries.edit') . '?id=' . $this->getEntryID($query) . '&type=editor',
|
||||
'title' => __('admin_content'),
|
||||
'attributes' => ['class' => 'navbar-item']
|
||||
],
|
||||
'edit_entry_media' => [
|
||||
'link' => $this->router->pathFor('admin.entries.edit') . '?id=' . $id . '&type=media',
|
||||
'link' => $this->router->pathFor('admin.entries.edit') . '?id=' . $this->getEntryID($query) . '&type=media',
|
||||
'title' => __('admin_media'),
|
||||
'attributes' => ['class' => 'navbar-item active']
|
||||
],
|
||||
'edit_entry_source' => [
|
||||
'link' => $this->router->pathFor('admin.entries.edit') . '?id=' . $id . '&type=source',
|
||||
'link' => $this->router->pathFor('admin.entries.edit') . '?id=' . $this->getEntryID($query) . '&type=source',
|
||||
'title' => __('admin_source'),
|
||||
'attributes' => ['class' => 'navbar-item']
|
||||
],
|
||||
@@ -635,24 +634,24 @@ class EntriesController extends Controller
|
||||
$response,
|
||||
'plugins/admin/views/templates/content/entries/edit.html',
|
||||
[
|
||||
'parts' => $_id,
|
||||
'i' => count($_id),
|
||||
'last' => Arr::last($_id),
|
||||
'parts' => $parts,
|
||||
'i' => count($parts),
|
||||
'last' => Arr::last($parts),
|
||||
'form' => $this->fetchForm($fieldsets, $entry, $request),
|
||||
'menu_item' => 'entries',
|
||||
'links' => [
|
||||
'edit_entry' => [
|
||||
'link' => $this->router->pathFor('admin.entries.edit') . '?id=' . $id,
|
||||
'link' => $this->router->pathFor('admin.entries.edit') . '?id=' . $this->getEntryID($query) . '&type=editor',
|
||||
'title' => __('admin_content'),
|
||||
'attributes' => ['class' => 'navbar-item active']
|
||||
],
|
||||
'edit_entry_media' => [
|
||||
'link' => $this->router->pathFor('admin.entries.edit') . '?id=' . $id . '&type=media',
|
||||
'link' => $this->router->pathFor('admin.entries.edit') . '?id=' . $this->getEntryID($query) . '&type=media',
|
||||
'title' => __('admin_media'),
|
||||
'attributes' => ['class' => 'navbar-item']
|
||||
],
|
||||
'edit_entry_source' => [
|
||||
'link' => $this->router->pathFor('admin.entries.edit') . '?id=' . $id . '&type=source',
|
||||
'link' => $this->router->pathFor('admin.entries.edit') . '?id=' . $this->getEntryID($query) . '&type=source',
|
||||
'title' => __('admin_source'),
|
||||
'attributes' => ['class' => 'navbar-item']
|
||||
],
|
||||
|
@@ -14,7 +14,7 @@
|
||||
<tr>
|
||||
<td>
|
||||
{% set entries = entries_fetch_all(entry.slug, 'slug', 'ASC') %}
|
||||
<a href="{% if entries|length > 0 %}{{ base_url() }}/admin/entries?id={{ entry.slug }}{% else %}{{ base_url() }}/admin/entries/edit?id={{ entry.slug }}{% endif %}">
|
||||
<a href="{% if entries|length > 0 %}{{ base_url() }}/admin/entries?id={{ entry.slug }}{% else %}{{ base_url() }}/admin/entries/edit?id={{ entry.slug }}&type=editor{% endif %}">
|
||||
{% if entry.fieldset %}
|
||||
{% set fieldset_path = PATH_SITE ~ '/fieldsets/' ~ entry.fieldset ~ '.json' %}
|
||||
{% if filesystem_has(fieldset_path) %}
|
||||
@@ -37,7 +37,7 @@
|
||||
</td>
|
||||
<td class="text-right">
|
||||
<div class="btn-group">
|
||||
<a class="btn btn-default" href="{{ path_for('admin.entries.edit') }}?id={{ entry.slug }}">{{ tr('admin_edit') }}</a>
|
||||
<a class="btn btn-default" href="{{ path_for('admin.entries.edit') }}?id={{ entry.slug }}&type=editor">{{ tr('admin_edit') }}</a>
|
||||
<button type="button" class="btn btn-default dropdown-toggle dropdown-toggle-split" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
|
||||
<span class="sr-only">Toggle Dropdown</span>
|
||||
</button>
|
||||
|
Reference in New Issue
Block a user