Skip to content

Commit

Permalink
Added FileWithTitleType.php, update custom_bootstrap_4_horizontal_lay…
Browse files Browse the repository at this point in the history
…out.html.twig
  • Loading branch information
twin-elements committed Sep 21, 2021
1 parent c3b05c7 commit 0990434
Show file tree
Hide file tree
Showing 4 changed files with 41 additions and 13 deletions.
4 changes: 3 additions & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,9 @@
],
"require": {
"php": "^7.1.3",
"artgris/filemanager-bundle": "^2.2"
"artgris/filemanager-bundle": "^2.2",
"twin-elements/seo-bundle": "^1.0",
"symfony/framework-bundle": "^4.4"
},
"autoload": {
"psr-4": {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
{% use 'bootstrap_4_horizontal_layout.html.twig' %}
{% use '@TwinElementsAdmin/block/blocks.html.twig' %}
{% use '@TwinElementsSeo/seo-fields.html.twig' %}

{% block tinymce_type_row %}
<div class="row form-group tinymce-widget">
Expand Down Expand Up @@ -59,17 +60,6 @@
</div>
{% endblock choice_widget_expanded %}

{% block seo_type_row %}
<div id="seo-type-widget">
<label>SEO</label>
<div>
{% for child in form.children %}
{{ form_row(child) }}
{% endfor %}
</div>
</div>
{% endblock %}

{% block images_type_widget %}
{% for choice in choices %}
<div class="col-md-3 ">
Expand Down
36 changes: 36 additions & 0 deletions src/Type/FileWithTitleType.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
<?php

namespace TwinElements\FormExtensions\Type;

use Symfony\Component\Form\AbstractType;
use Symfony\Component\Form\Extension\Core\Type\TextType;
use Symfony\Component\Form\FormBuilderInterface;
use Symfony\Component\OptionsResolver\OptionsResolver;

class FileWithTitleType extends AbstractType
{
public function buildForm(FormBuilderInterface $builder, array $options)
{
$builder
->add('title', TextType::class, [
'label' => 'Tytuł pliku'
])
->add('file', TEUploadType::class, [
'label' => 'Plik',
'required' => false,
'conf' => $options['conf']
]);
}

public function configureOptions(OptionsResolver $resolver)
{
$resolver
->setDefault('conf', null)
->setDefault('file_type', null);
}

public function getBlockPrefix()
{
return 'file_with_title_type';
}
}
2 changes: 1 addition & 1 deletion src/Type/SingleAttachmentType.php
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,6 @@ public function configureOptions(OptionsResolver $resolver)

public function getBlockPrefix()
{
return 'custom_bundle_single_attachment_type';
return 'single_attachment_type';
}
}

0 comments on commit 0990434

Please sign in to comment.