1
0
mirror of https://github.com/flextype/flextype.git synced 2025-08-23 05:16:03 +02:00

feat(admin-plugin): update UsersController #186

add ability to set:
- created_by
- published_by
- published_at
- created_at

for default site entries
This commit is contained in:
Awilum
2019-08-30 21:47:39 +03:00
parent c4348d8e6f
commit 2cb0f9bd38

View File

@@ -201,6 +201,8 @@ class EntriesController extends Controller
$data_from_post['published_at'] = time();
$data_from_post['created_at'] = time();
$data_from_post['uuid'] = Uuid::uuid4()->toString();
$data_from_post['published_by'] = Session::get('uuid');
$data_from_post['created_by'] = Session::get('uuid');
// Predefine data values based on selected fieldset
foreach ($fieldset['sections'] as $key => $section) {
@@ -340,6 +342,8 @@ class EntriesController extends Controller
Arr::delete($_data, 'save_entry');
Arr::delete($_data, 'id');
$_data['published_by'] = Session::get('uuid');
$data = array_merge($entry, $_data);
if ($this->entries->update(
@@ -772,6 +776,8 @@ class EntriesController extends Controller
// Data from POST
$data = $request->getParsedBody();
$data['published_by'] = Session::get('uuid');
// Update entry
if ($this->entries->update($id, Parser::decode($data['data'], $data['parser']))) {
$this->flash->addMessage('success', __('admin_message_entry_changes_saved'));
@@ -791,6 +797,8 @@ class EntriesController extends Controller
Arr::delete($data, 'csrf_name');
Arr::delete($data, 'action');
$data['published_by'] = Session::get('uuid');
// Fetch entry
$entry = $this->entries->fetch($id);
Arr::delete($entry, 'slug');