return $this->get(SectionResolver::class)->getCurrent(); | 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 | public function getCartCurrent(): OrderShopInterface |
const SETTING_ORDER_CLOSED_START = 'orderClosedStart'; | const SETTING_ORDER_CLOSED_START = 'orderClosedStart'; | ||||
const SETTING_ORDER_CLOSED_END = 'orderClosedEnd'; | const SETTING_ORDER_CLOSED_END = 'orderClosedEnd'; | ||||
const SETTING_ORDER_MAXIMUM_PER_CYCLE = 'orderMaximumPerCycle'; | 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_DEFAULT = 'default'; | ||||
const VALUE_ORDER_STATE_OPEN = 'open'; | const VALUE_ORDER_STATE_OPEN = 'open'; | ||||
'category' => self::CATEGORY_GENERAL, | '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() | public function getCategories() |
$label = 'setting_definition.'.$transCategory.'.settings.'.$settingName ; | $label = 'setting_definition.'.$transCategory.'.settings.'.$settingName ; | ||||
if(isset($settingDefinition) && $settingDefinition) { | if(isset($settingDefinition) && $settingDefinition) { | ||||
$this->buildFormSetting($label, $form, $settingDefinition, $settingEntity); | $this->buildFormSetting($label, $form, $settingDefinition, $settingEntity); | ||||
} | } | ||||
} | } |
class SectionSettingsFormType extends AbstractType | class SectionSettingsFormType extends AbstractType | ||||
{ | { | ||||
protected $em; | |||||
protected $translatorAdmin; | |||||
protected EntityManagerInterface $em; | |||||
protected TranslatorAdmin $translatorAdmin; | |||||
public function __construct(EntityManagerInterface $em, TranslatorAdmin $translatorAdmin) | public function __construct(EntityManagerInterface $em, TranslatorAdmin $translatorAdmin) | ||||
{ | { |
public function filtersDefault(RepositoryQueryInterface $query): RepositoryQueryInterface | public function filtersDefault(RepositoryQueryInterface $query): RepositoryQueryInterface | ||||
{ | { | ||||
$query->filterByMerchant($this->merchant); | |||||
$this->addFilterByMerchantOptionnal($query); | |||||
return $query; | return $query; | ||||
} | } | ||||
return $query; | 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) | public function getOneDefault($query = null) | ||||
{ | { | ||||
$query = $this->createDefaultQuery($query); | $query = $this->createDefaultQuery($query); |
return $currentAdminSection; | return $currentAdminSection; | ||||
} // front | } // front | ||||
else { | else { | ||||
$sectionStore = $this->sectionStore->setMerchant($this->merchantResolver->getCurrent()); | |||||
$merchantCurrent = $this->merchantResolver->getCurrent(); | |||||
$sectionStore = $this->sectionStore->setMerchant($merchantCurrent); | |||||
$sectionCurrent = null; | $sectionCurrent = null; | ||||
$sectionDefault = $sectionStore->getOneDefault(); | $sectionDefault = $sectionStore->getOneDefault(); | ||||
if(isset($requestAttributesArray['section'])) { | if(isset($requestAttributesArray['section'])) { | ||||
$sectionCurrent = $sectionStore->getOneBySlug($requestAttributesArray['section']); | |||||
$sectionCurrent = $sectionStore | |||||
->setMerchant($merchantCurrent) | |||||
->getOneBySlug($requestAttributesArray['section']); | |||||
} | } | ||||
return $sectionCurrent ?: $sectionDefault; | return $sectionCurrent ?: $sectionDefault; |
orderClosedStart: Période commandes fermées (début) | orderClosedStart: Période commandes fermées (début) | ||||
orderClosedEnd: Période commandes fermées (fin) | orderClosedEnd: Période commandes fermées (fin) | ||||
orderMaximumPerCycle: Nombre maximum de commande par cycle de vente | orderMaximumPerCycle: Nombre maximum de commande par cycle de vente | ||||
colorPrimary: Couleur primaire | |||||
colorSecondary: Couleur secondaire | |||||
entity: | entity: | ||||
default: | default: |
new TwigFunction('merchant_current', [$this, 'getMerchantCurrent']), | new TwigFunction('merchant_current', [$this, 'getMerchantCurrent']), | ||||
new TwigFunction('user_merchant_current', [$this, 'getUserMerchantCurrent']), | new TwigFunction('user_merchant_current', [$this, 'getUserMerchantCurrent']), | ||||
new TwigFunction('section_current', [$this, 'getSectionCurrent']), | 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', [$this, 'getMerchantSetting']), | ||||
new TwigFunction('merchant_setting_current', [$this, 'getMerchantSettingCurrent']), | new TwigFunction('merchant_setting_current', [$this, 'getMerchantSettingCurrent']), | ||||
new TwigFunction('section_setting', [$this, 'getSectionSetting']), | new TwigFunction('section_setting', [$this, 'getSectionSetting']), | ||||
return $this->sectionResolver->getCurrent(); | return $this->sectionResolver->getCurrent(); | ||||
} | } | ||||
public function getSectionSlugCurrent(): string | |||||
public function getSectionCurrentSlug(): string | |||||
{ | { | ||||
return $this->sectionResolver->getCurrent()->getSlug(); | return $this->sectionResolver->getCurrent()->getSlug(); | ||||
} | } | ||||
return $this->settingSolver->getSettingValue($section, $settingName); | 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); | return $this->settingSolver->getSettingValue($this->getSectionCurrent(), $settingName); | ||||
} | } |