@@ -51,13 +51,16 @@ public function __construct(
5151 */
5252 public function buildForm (FormBuilderInterface $ builder , array $ options ): void
5353 {
54+ /** @var \Shopsys\FrameworkBundle\Model\Article\Article|null $article */
55+ $ article = $ options ['article ' ];
56+
5457 $ seoMetaDescriptionAttributes = $ this ->getSeoMetaDescriptionAttributes ($ options );
5558
5659 $ builderArticleData = $ builder ->create ('articleData ' , GroupType::class, [
5760 'label ' => t ('Article data ' ),
5861 ]);
5962
60- if ($ options [ ' article ' ] === null ) {
63+ if ($ article === null ) {
6164 $ builderArticleData
6265 ->add ('domainId ' , DomainType::class, [
6366 'required ' => true ,
@@ -76,11 +79,11 @@ public function buildForm(FormBuilderInterface $builder, array $options): void
7679 } else {
7780 $ builderArticleData
7881 ->add ('id ' , DisplayOnlyType::class, [
79- 'data ' => $ options [ ' article ' ] ->getId (),
82+ 'data ' => $ article ->getId (),
8083 'label ' => t ('ID ' ),
8184 ])
8285 ->add ('domain ' , DisplayOnlyType::class, [
83- 'data ' => $ this ->domain ->getDomainConfigById ($ options [ ' article ' ] ->getDomainId ())->getName (),
86+ 'data ' => $ this ->domain ->getDomainConfigById ($ article ->getDomainId ())->getName (),
8487 'label ' => t ('Domain ' ),
8588 ]);
8689 }
@@ -176,12 +179,13 @@ public function buildForm(FormBuilderInterface $builder, array $options): void
176179 'label ' => t ('Heading (H1) ' ),
177180 ]);
178181
179- if ($ options [ ' article ' ] !== null ) {
182+ if ($ article !== null ) {
180183 $ builderSeoData
181184 ->add ('urls ' , UrlListType::class, [
182185 'label ' => t ('URL addresses ' ),
183186 'route_name ' => 'front_article_detail ' ,
184- 'entity_id ' => $ options ['article ' ]->getId (),
187+ 'entity_id ' => $ article ->getId (),
188+ 'limit_domains_by_ids ' => [$ article ->getDomainId ()],
185189 ]);
186190 }
187191
@@ -190,7 +194,7 @@ public function buildForm(FormBuilderInterface $builder, array $options): void
190194 ->add ($ builderSeoData )
191195 ->add ('actionBar ' , ActionBarType::class, [
192196 'back_route ' => 'admin_article_list ' ,
193- 'entity ' => $ options [ ' article ' ] ,
197+ 'entity ' => $ article ,
194198 ]);
195199 }
196200
0 commit comments