1
0
mirror of https://github.com/flextype/flextype.git synced 2025-08-27 06:54:31 +02:00

Flextype Box Plugin: Admin #125 #117

- Fieldsets Controller/Views implementation
This commit is contained in:
Awilum
2019-05-24 14:27:47 +03:00
parent ea9bf43c32
commit bf94e6c842

View File

@@ -2,6 +2,8 @@
namespace Flextype;
use Flextype\Component\Arr\Arr;
use Flextype\Component\Text\Text;
use function Flextype\Component\I18n\__;
class FieldsetsController extends Controller
@@ -54,7 +56,21 @@ class FieldsetsController extends Controller
public function addProcess($request, $response, $args)
{
$data = $request->getParsedBody();
Arr::delete($data, 'csrf_name');
Arr::delete($data, 'csrf_value');
$id = Text::safeString($data['name'], '-', true);
$data = ['title' => $data['title']];
if ($this->fieldsets->create($id, $data)) {
$this->flash->addMessage('success', __('admin_message_fieldset_created'));
} else {
$this->flash->addMessage('error', __('admin_message_fieldset_was_not_created'));
}
return $response->withRedirect($this->container->get('router')->urlFor('admin.fieldsets.index'));
}
public function edit($request, $response, $args)