1
0
mirror of https://github.com/flextype/flextype.git synced 2025-08-13 16:44:36 +02:00

Flextype Box Plugin: Admin #125 #117

- Entries Controller/Views implementation
This commit is contained in:
Awilum
2019-05-16 12:32:36 +03:00
parent feac619578
commit 60cf84c08b

View File

@@ -165,7 +165,43 @@ class EntriesController extends Controller
public function type($request, $response, $args)
{
$entry = $this->entries->fetch($this->getEntriesQuery($request->getQueryParams()['entry']));
$fieldsets = [];
// Get fieldsets files
$_fieldsets = Filesystem::listContents(PATH['themes'] . '/' . $this->registry->get('settings.theme') . '/fieldsets/');
// If there is any template file then go...
if (count($_fieldsets) > 0) {
foreach ($_fieldsets as $fieldset) {
if ($fieldset['type'] == 'file' && $fieldset['extension'] == 'json') {
$fieldset_content = JsonParser::decode(Filesystem::read($fieldset['path']));
if (isset($fieldset_content['sections']) && isset($fieldset_content['sections']['main']) && isset($fieldset_content['sections']['main']['fields'])) {
$fieldsets[$fieldset['basename']] = $fieldset_content['title'];
}
}
}
}
return $this->view->render($response,
'plugins/admin/views/templates/content/entries/type.html', [
'fieldset' => $entry['fieldset'],
'fieldsets' => $fieldsets,
'menu_item' => 'entries',
'links' => [
'entries' => [
'link' => $this->router->urlFor('admin.entries.index'),
'title' => __('admin_entries'),
'attributes' => ['class' => 'navbar-item']
],
'entries_type' => [
'link' => $this->router->urlFor('admin.entries.type') . '?entry=' . $this->getEntriesQuery($request->getQueryParams()['entry']),
'title' => __('admin_type'),
'attributes' => ['class' => 'navbar-item active']
]
]
]);
}
public function move($request, $response, $args)