Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
32 changes: 32 additions & 0 deletions FieldType/Html.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
<?php

namespace Sherlockode\AdvancedContentBundle\FieldType;

use Symfony\Component\Form\Extension\Core\Type\TextareaType;

class Html extends AbstractFieldType
{
/**
* @return string
*/
public function getFormFieldType()
{
return TextareaType::class;
}

/**
* @return string
*/
protected function getDefaultIconClass()
{
return 'fa-solid fa-code';
}

/**
* @return string
*/
public function getCode()
{
return 'html';
}
}
3 changes: 3 additions & 0 deletions Resources/config/field_types.xml
Original file line number Diff line number Diff line change
Expand Up @@ -45,5 +45,8 @@
<argument type="service" id="sherlockode_advanced_content.scope_handler"/>
<tag name="sherlockode_advanced_content.fieldtype"/>
</service>
<service id="sherlockode_acb.field_type.html" class="Sherlockode\AdvancedContentBundle\FieldType\Html">
<tag name="sherlockode_advanced_content.fieldtype"/>
</service>
</services>
</container>
2 changes: 2 additions & 0 deletions Resources/translations/AdvancedContentBundle.en.yml
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,8 @@ field_type:
image_label: Slide %nb%
arrow_previous: Previous
arrow_next: Next
html:
label: HTML
group:
other: Others
simple: Simple
Expand Down
2 changes: 2 additions & 0 deletions Resources/translations/AdvancedContentBundle.fr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,8 @@ field_type:
image_label: Image %nb%
arrow_previous: Précédent
arrow_next: Suivant
html:
label: HTML
group:
other: Autres
simple: Simple
Expand Down
11 changes: 11 additions & 0 deletions Resources/views/Field/front/html.html.twig
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
{% if value is not empty %}
{% set attributes = acb_get_element_attributes(extra|default([])) %}
{% set style = attributes.style|default('') %}

<div class="{{ attributes.classes }}"
{% if attributes.id %}id="{{ attributes.id }}"{% endif %}
{% if style|trim is not empty %}style="{{ style }}"{% endif %}
>
{{ value | raw }}
</div>
{% endif %}
11 changes: 11 additions & 0 deletions Resources/views/Field/preview/html.html.twig
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
{% if value is not empty %}
{% set attributes = acb_get_element_attributes(extra|default([])) %}
{% set style = attributes.style|default('') %}

<div class="{{ attributes.classes }}"
{% if attributes.id %}id="{{ attributes.id }}"{% endif %}
{% if style|trim is not empty %}style="{{ style }}"{% endif %}
>
{{ value | raw }}
</div>
{% endif %}