@@ -142,9 +142,9 @@ trait ControllerTrait | |||
return $this->get(SectionResolver::class)->getCurrent(); | |||
} | |||
public function getSectionCurrentSlug(): string | |||
public function getSectionCurrentDevAlias(): string | |||
{ | |||
return $this->getSectionCurrent()->getSlug(); | |||
return $this->getSectionCurrent()->getDevAlias(); | |||
} | |||
public function getCartCurrent(): OrderShopInterface |
@@ -13,6 +13,8 @@ class SectionSettingDefinition extends AbstractSettingDefinition | |||
const SETTING_ORDER_CLOSED_START = 'orderClosedStart'; | |||
const SETTING_ORDER_CLOSED_END = 'orderClosedEnd'; | |||
const SETTING_ORDER_MAXIMUM_PER_CYCLE = 'orderMaximumPerCycle'; | |||
/*const SETTING_COLOR_PRIMARY = 'colorPrimary'; | |||
const SETTING_COLOR_SECONDARY = 'colorSecondary';*/ | |||
const VALUE_ORDER_STATE_DEFAULT = 'default'; | |||
const VALUE_ORDER_STATE_OPEN = 'open'; | |||
@@ -60,6 +62,19 @@ class SectionSettingDefinition extends AbstractSettingDefinition | |||
'category' => self::CATEGORY_GENERAL, | |||
] | |||
); | |||
/*$this->addSettingText( | |||
[ | |||
'name' => self::SETTING_COLOR_PRIMARY, | |||
'category' => self::CATEGORY_GENERAL, | |||
] | |||
); | |||
$this->addSettingText( | |||
[ | |||
'name' => self::SETTING_COLOR_SECONDARY, | |||
'category' => self::CATEGORY_GENERAL, | |||
] | |||
);*/ | |||
} | |||
public function getCategories() |
@@ -59,9 +59,6 @@ abstract class BaseSettingType extends SovBaseSettingType | |||
$label = 'setting_definition.'.$transCategory.'.settings.'.$settingName ; | |||
if(isset($settingDefinition) && $settingDefinition) { | |||
$this->buildFormSetting($label, $form, $settingDefinition, $settingEntity); | |||
} | |||
} |
@@ -13,8 +13,8 @@ use Symfony\Component\OptionsResolver\OptionsResolver; | |||
class SectionSettingsFormType extends AbstractType | |||
{ | |||
protected $em; | |||
protected $translatorAdmin; | |||
protected EntityManagerInterface $em; | |||
protected TranslatorAdmin $translatorAdmin; | |||
public function __construct(EntityManagerInterface $em, TranslatorAdmin $translatorAdmin) | |||
{ |
@@ -30,7 +30,7 @@ class SectionStore extends AbstractStore | |||
public function filtersDefault(RepositoryQueryInterface $query): RepositoryQueryInterface | |||
{ | |||
$query->filterByMerchant($this->merchant); | |||
$this->addFilterByMerchantOptionnal($query); | |||
return $query; | |||
} | |||
@@ -39,6 +39,19 @@ class SectionStore extends AbstractStore | |||
return $query; | |||
} | |||
public function getOneBySlug(string $slug, bool $isOnline = true, $query = null) | |||
{ | |||
$query = $this->createDefaultQuery($query); | |||
$query->filterBySlug($slug); | |||
if ($isOnline) { | |||
$query->filterIsOnline(); | |||
} | |||
return $query->findOne(); | |||
} | |||
public function getOneDefault($query = null) | |||
{ | |||
$query = $this->createDefaultQuery($query); |
@@ -61,12 +61,15 @@ class SectionResolver | |||
return $currentAdminSection; | |||
} // front | |||
else { | |||
$sectionStore = $this->sectionStore->setMerchant($this->merchantResolver->getCurrent()); | |||
$merchantCurrent = $this->merchantResolver->getCurrent(); | |||
$sectionStore = $this->sectionStore->setMerchant($merchantCurrent); | |||
$sectionCurrent = null; | |||
$sectionDefault = $sectionStore->getOneDefault(); | |||
if(isset($requestAttributesArray['section'])) { | |||
$sectionCurrent = $sectionStore->getOneBySlug($requestAttributesArray['section']); | |||
$sectionCurrent = $sectionStore | |||
->setMerchant($merchantCurrent) | |||
->getOneBySlug($requestAttributesArray['section']); | |||
} | |||
return $sectionCurrent ?: $sectionDefault; |
@@ -43,6 +43,8 @@ setting_definition: | |||
orderClosedStart: Période commandes fermées (début) | |||
orderClosedEnd: Période commandes fermées (fin) | |||
orderMaximumPerCycle: Nombre maximum de commande par cycle de vente | |||
colorPrimary: Couleur primaire | |||
colorSecondary: Couleur secondaire | |||
entity: | |||
default: |
@@ -85,7 +85,7 @@ class StoreTwigExtension extends AbstractExtension | |||
new TwigFunction('merchant_current', [$this, 'getMerchantCurrent']), | |||
new TwigFunction('user_merchant_current', [$this, 'getUserMerchantCurrent']), | |||
new TwigFunction('section_current', [$this, 'getSectionCurrent']), | |||
new TwigFunction('section_slug_current', [$this, 'getSectionSlugCurrent']), | |||
new TwigFunction('section_current_slug', [$this, 'getSectionCurrentSlug']), | |||
new TwigFunction('merchant_setting', [$this, 'getMerchantSetting']), | |||
new TwigFunction('merchant_setting_current', [$this, 'getMerchantSettingCurrent']), | |||
new TwigFunction('section_setting', [$this, 'getSectionSetting']), | |||
@@ -110,7 +110,7 @@ class StoreTwigExtension extends AbstractExtension | |||
return $this->sectionResolver->getCurrent(); | |||
} | |||
public function getSectionSlugCurrent(): string | |||
public function getSectionCurrentSlug(): string | |||
{ | |||
return $this->sectionResolver->getCurrent()->getSlug(); | |||
} | |||
@@ -149,7 +149,7 @@ class StoreTwigExtension extends AbstractExtension | |||
return $this->settingSolver->getSettingValue($section, $settingName); | |||
} | |||
public function getSectionSettingCurrent(string $settingName): string | |||
public function getSectionSettingCurrent(string $settingName): ?string | |||
{ | |||
return $this->settingSolver->getSettingValue($this->getSectionCurrent(), $settingName); | |||
} |