Skip to content

Commit

Permalink
KUN-8981 | (fix) set internal as default option
Browse files Browse the repository at this point in the history
  • Loading branch information
mart-insiders committed Sep 30, 2024
1 parent 2d49e45 commit c1bba76
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ public function transform($value): array

if ($value === null) {
return [
'link_type' => URLChooserType::EXTERNAL,
'link_type' => URLChooserType::INTERNAL,
'link_url' => null,
];
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@

class InternalURLSelectorType extends AbstractType
{
public function buildForm(FormBuilderInterface $builder, array $options)
public function buildForm(FormBuilderInterface $builder, array $options): void
{
$builder->add('input', HiddenType::class, [
'label' => false,
Expand All @@ -23,7 +23,7 @@ public function buildForm(FormBuilderInterface $builder, array $options)
]);
}

public function getBlockPrefix()
public function getBlockPrefix(): string
{
return 'internal_url_selector';
}
Expand Down
2 changes: 1 addition & 1 deletion src/Kunstmaan/NodeBundle/Form/Type/URLTypeType.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ public function configureOptions(OptionsResolver $resolver): void
$resolver->setAllowedTypes('choices', 'array');
}

public function buildView(FormView $view, FormInterface $form, array $options)
public function buildView(FormView $view, FormInterface $form, array $options): void
{
$view->vars['choices'] = $options['choices'];
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,17 +60,16 @@
<input type="hidden" name="{{ linkUrl.full_name }}" value="{{ linkUrl.value ? linkUrl.value : '' }}" id="{{ linkUrl.id }}" class="form-control {% if linkUrl.attr is defined and linkUrl.attr.class is defined %}{{ linkUrl.attr.class }}{% endif %}">
<input type="text" disabled="disabled" class="form-control js-urlchooser-value" value="{{ linkUrl.value ? linkUrl.value|replace_url : '' }}">
<span class="input-group-btn">
<button type="button" class="btn btn-default btn--raise-on-hover" data-toggle="modal" data-target="#{{ linkUrl.id }}-urlChooserModal" data-link="{{ path('KunstmaanNodeBundle_selecturl') }}">
{{ 'kuma_node.widget.choose' | trans }}
</button>
</span>
<button type="button" class="btn btn-default btn--raise-on-hover" data-toggle="modal" data-target="#{{ linkUrl.id }}-urlChooserModal" data-link="{{ path('KunstmaanNodeBundle_selecturl') }}">
{{ 'kuma_node.widget.choose' | trans }}
</button>
</span>
{% else %}
<input type="text" name="{{ linkUrl.full_name }}" value="{{ linkUrl.value ? linkUrl.value : '' }}" id="{{ linkUrl.id }}" class="form-control {% if linkUrl.attr is defined and linkUrl.attr.class is defined %}{{ linkUrl.attr.class }}{% endif %}"{% if linkUrl.attr is defined and linkUrl.attr.placeholder is defined %} placeholder="{{ linkUrl.attr.placeholder }}"{% endif %}>
{% endif %}
</div>
</div>
</div>

</div>
{% else %}
{% set linkUrl = form.link_url.vars %}
Expand Down

0 comments on commit c1bba76

Please sign in to comment.