mirror of
https://github.com/flextype/flextype.git
synced 2025-08-15 01:24:25 +02:00
Flextype 0.9.0 - [epic] #117
- Fieldsets moved to parent /site/ directory
This commit is contained in:
@@ -180,7 +180,7 @@ class Fieldsets
|
||||
*/
|
||||
private function _dir_location() : string
|
||||
{
|
||||
return PATH['themes'] . '/' . $this->flextype['registry']->get('settings.theme') . '/fieldsets/';
|
||||
return PATH['site'] . '/fieldsets/';
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -192,6 +192,6 @@ class Fieldsets
|
||||
*/
|
||||
private function _file_location(string $id) : string
|
||||
{
|
||||
return PATH['themes'] . '/' . $this->flextype['registry']->get('settings.theme') . '/fieldsets/' . $id . '.json';
|
||||
return PATH['site'] . '/fieldsets/' . $id . '.json';
|
||||
}
|
||||
}
|
||||
|
@@ -66,7 +66,7 @@ class EntriesController extends Controller
|
||||
$fieldsets = [];
|
||||
|
||||
// Get fieldsets files
|
||||
$_fieldsets = Filesystem::listContents(PATH['themes'] . '/' . $this->registry->get('settings.theme') . '/fieldsets/');
|
||||
$_fieldsets = Filesystem::listContents(PATH['site'] . '/' . '/fieldsets/');
|
||||
|
||||
// If there is any template file then go...
|
||||
if (count($_fieldsets) > 0) {
|
||||
@@ -121,11 +121,11 @@ class EntriesController extends Controller
|
||||
if (!$this->entries->has($entry)) {
|
||||
|
||||
// Get fieldset
|
||||
$fieldset = JsonParser::decode(Filesystem::read(PATH['themes'] . '/' . $this->registry->get('settings.theme') . '/fieldsets/' . $data['fieldset'] . '.json'));
|
||||
$fieldset = JsonParser::decode(Filesystem::read(PATH['site'] . '/' . '/fieldsets/' . $data['fieldset'] . '.json'));
|
||||
|
||||
// We need to check if template for current fieldset is exists
|
||||
// if template is not exist then default template will be used!
|
||||
$template_path = PATH['themes'] . '/' . $this->registry->get('settings.theme') . '/templates/' . $data['fieldset'] . '.html';
|
||||
$template_path = PATH['site'] . '/' . '/templates/' . $data['fieldset'] . '.html';
|
||||
if (Filesystem::has($template_path)) {
|
||||
$template = $data['fieldset'];
|
||||
} else {
|
||||
@@ -191,7 +191,7 @@ class EntriesController extends Controller
|
||||
$fieldsets = [];
|
||||
|
||||
// Get fieldsets files
|
||||
$_fieldsets = Filesystem::listContents(PATH['themes'] . '/' . $this->registry->get('settings.theme') . '/fieldsets/');
|
||||
$_fieldsets = Filesystem::listContents(PATH['site'] . '/' . '/fieldsets/');
|
||||
|
||||
// If there is any template file then go...
|
||||
if (count($_fieldsets) > 0) {
|
||||
@@ -503,7 +503,7 @@ class EntriesController extends Controller
|
||||
$entry = $this->entries->fetch($entry_name);
|
||||
|
||||
// Fieldset for current entry template
|
||||
$fieldsets_path = PATH['themes'] . '/' . $this->registry->get('settings.theme') . '/fieldsets/' . (isset($entry['fieldset']) ? $entry['fieldset'] : 'default') . '.json';
|
||||
$fieldsets_path = PATH['site'] . '/' . '/fieldsets/' . (isset($entry['fieldset']) ? $entry['fieldset'] : 'default') . '.json';
|
||||
$fieldsets = JsonParser::decode(Filesystem::read($fieldsets_path));
|
||||
is_null($fieldsets) and $fieldsets = [];
|
||||
|
||||
|
@@ -59,7 +59,7 @@ class TemplatesController extends Controller
|
||||
|
||||
$id = Text::safeString($request->getParsedBody()['id'], '-', true) . '.html';
|
||||
|
||||
$file = PATH['themes'] . '/' . $this->registry->get('settings.theme') . $this->_type_location($type) . $id;
|
||||
$file = PATH['site'] . '/' . $this->_type_location($type) . $id;
|
||||
|
||||
if (!Filesystem::has($file)) {
|
||||
if (Filesystem::write(
|
||||
@@ -87,7 +87,7 @@ class TemplatesController extends Controller
|
||||
[
|
||||
'menu_item' => 'templates',
|
||||
'id' => $request->getQueryParams()['id'],
|
||||
'data' => Filesystem::read(PATH['themes'] . '/' . $this->registry->get('settings.theme') . $this->_type_location($type) . $request->getQueryParams()['id'] . '.html'),
|
||||
'data' => Filesystem::read(PATH['site'] . '/' . $this->_type_location($type) . $request->getQueryParams()['id'] . '.html'),
|
||||
'type' => (($request->getQueryParams()['type'] && $request->getQueryParams()['type'] == 'partial') ? 'partial' : 'template'),
|
||||
'links' => [
|
||||
'templates' => [
|
||||
@@ -111,7 +111,7 @@ class TemplatesController extends Controller
|
||||
{
|
||||
$type = $request->getParsedBody()['type_current'];
|
||||
|
||||
if (Filesystem::write(PATH['themes'] . '/' . $this->registry->get('settings.theme') . $this->_type_location($type) . $request->getParsedBody()['id'] . '.html', $request->getParsedBody()['data'])) {
|
||||
if (Filesystem::write(PATH['site'] . '/' . $this->_type_location($type) . $request->getParsedBody()['id'] . '.html', $request->getParsedBody()['data'])) {
|
||||
$this->flash->addMessage('success', __('admin_message_'.$type.'_saved'));
|
||||
} else {
|
||||
$this->flash->addMessage('error', __('admin_message_'.$type.'_was_not_saved'));
|
||||
@@ -145,10 +145,10 @@ class TemplatesController extends Controller
|
||||
{
|
||||
$type = $request->getParsedBody()['type_current'];
|
||||
|
||||
if (!Filesystem::has(PATH['themes'] . '/' . $this->registry->get('settings.theme') . $this->_type_location($type) . $request->getParsedBody()['id'] . '.html')) {
|
||||
if (!Filesystem::has(PATH['site'] . '/' . $this->_type_location($type) . $request->getParsedBody()['id'] . '.html')) {
|
||||
if (Filesystem::rename(
|
||||
PATH['themes'] . '/' . $this->registry->get('settings.theme') . $this->_type_location($type) . $request->getParsedBody()['id_current'] . '.html',
|
||||
PATH['themes'] . '/' . $this->registry->get('settings.theme') . $this->_type_location($type) . $request->getParsedBody()['id'] . '.html'
|
||||
PATH['site'] . '/' . $this->_type_location($type) . $request->getParsedBody()['id_current'] . '.html',
|
||||
PATH['site'] . '/' . $this->_type_location($type) . $request->getParsedBody()['id'] . '.html'
|
||||
)
|
||||
) {
|
||||
$this->flash->addMessage('success', __('admin_message_'.$type.'_renamed'));
|
||||
@@ -166,7 +166,7 @@ class TemplatesController extends Controller
|
||||
{
|
||||
$type = $request->getParsedBody()['type'];
|
||||
|
||||
$file_path = PATH['themes'] . '/' . $this->registry->get('settings.theme') . $this->_type_location($type) . $request->getParsedBody()[$type.'-id'] . '.html';
|
||||
$file_path = PATH['site'] . '/' . $this->_type_location($type) . $request->getParsedBody()[$type.'-id'] . '.html';
|
||||
|
||||
if (Filesystem::delete($file_path)) {
|
||||
$this->flash->addMessage('success', __('admin_message_'.$type.'_deleted'));
|
||||
@@ -181,8 +181,8 @@ class TemplatesController extends Controller
|
||||
{
|
||||
$type = $request->getParsedBody()['type'];
|
||||
|
||||
$file_path = PATH['themes'] . '/' . $this->registry->get('settings.theme') . $this->_type_location($type) . $request->getParsedBody()[$type.'-id'] . '.html';
|
||||
$file_path_new = PATH['themes'] . '/' . $this->registry->get('settings.theme') . $this->_type_location($type) . $request->getParsedBody()[$type.'-id'] . '-duplicate-' . date("Ymd_His") . '.html';
|
||||
$file_path = PATH['site'] . '/' . $this->_type_location($type) . $request->getParsedBody()[$type.'-id'] . '.html';
|
||||
$file_path_new = PATH['site'] . '/' . $this->_type_location($type) . $request->getParsedBody()[$type.'-id'] . '-duplicate-' . date("Ymd_His") . '.html';
|
||||
|
||||
if (Filesystem::copy($file_path, $file_path_new)) {
|
||||
$this->flash->addMessage('success', __('admin_message_'.$type.'_duplicated'));
|
||||
|
Reference in New Issue
Block a user