Skip to content

Commit

Permalink
Merge pull request #14 from NicolasBarbey/main
Browse files Browse the repository at this point in the history
page type is not mandatory
  • Loading branch information
zawaze authored Nov 20, 2023
2 parents 5d3341d + d2b5f73 commit 2397f77
Show file tree
Hide file tree
Showing 5 changed files with 6 additions and 8 deletions.
2 changes: 1 addition & 1 deletion Config/module.xml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
<language>en_US</language>
<language>fr_FR</language>
</languages>
<version>1.1.7</version>
<version>1.1.8</version>
<authors>
<author>
<name>Damien Foulhoux</name>
Expand Down
6 changes: 3 additions & 3 deletions Controller/Admin/PageController.php
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ public function createPageAction(Session $session, PageProvider $pageProvider, P
$pageProvider->createPage(
$formData['title'],
$formData['code'],
$formData['type'],
$formData['type'] ?: null,
$formData['thelia-block'],
$formData['description'],
$locale,
Expand Down Expand Up @@ -155,7 +155,7 @@ function(Page $page) use ($locale) {
'current_tab' => $request->get('current_tab')
]);
}

/**
* @Route("/update/{pageId}", name="_update_page_action", methods="POST")
*/
Expand All @@ -178,7 +178,7 @@ public function updatePageAction(Request $request, Session $session, PageProvide
$formData['title'],
$formData['code'],
$formData['tag'],
$formData['type'],
$formData['type'] ?: null,
$formData['description'],
$formData['chapo'],
$formData['postscriptum'],
Expand Down
1 change: 0 additions & 1 deletion Form/EditPageForm.php
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,6 @@ protected function buildForm()
'type',
ChoiceType::class,
[
"empty_data" => $this->translator->trans('Choose a block', [], 'page.bo.default'),
"choices" => $this->getPageTypes(),
'required' => false,
'label' => $this->translator->trans('Page type', [], 'page.bo.default'),
Expand Down
3 changes: 1 addition & 2 deletions Form/PageForm.php
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,6 @@ protected function buildForm()
'type',
ChoiceType::class,
[
"empty_data" => $this->translator->trans('Choose a page type', [], 'page.bo.default'),
"choices" => $this->getPageTypes(),
'required' => false,
'label' => $this->translator->trans('Page type', [], 'page.bo.default'),
Expand Down Expand Up @@ -84,7 +83,7 @@ protected function getPageTypes(): array
{
$choices = [];
$types = PageTypeQuery::create()->find();

$choices['No type'] = '';
/** @var PageType $type */
foreach ($types as $type) {
$choices[$type->getType()] = $type->getId();
Expand Down
2 changes: 1 addition & 1 deletion Service/PageProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ public function updatePage(
string $title,
string $code = null,
?string $tag = null,
int $typeId = null,
?int $typeId = null,
string $description = null,
string $chapo = null,
string $postscriptum = null,
Expand Down

0 comments on commit 2397f77

Please sign in to comment.