mirror of
https://gitlab.com/Chill-Projet/chill-bundles.git
synced 2025-06-13 22:04:23 +00:00
consistency in twig methods
The method chill_custom_fields_is_empty take now the fields as first argument, and the customField as second argument, to be consistent with other twig methods.
This commit is contained in:
parent
d2039893b3
commit
54391b02f3
@ -22,7 +22,7 @@
|
||||
{%- endif -%}
|
||||
{%- endif -%}
|
||||
{% else %}
|
||||
{%- if show_empty == true or (chill_custom_field_is_empty(customField, cFData) == false) -%}
|
||||
{%- if show_empty == true or (chill_custom_field_is_empty(cFData, customField) == false) -%}
|
||||
{%- if title is not empty -%}
|
||||
{{ chill_custom_field_widget(cFData, title) }}
|
||||
{%- set title = null -%}
|
||||
|
@ -85,7 +85,7 @@ class CustomFieldRenderingTwig extends \Twig_Extension implements ContainerAware
|
||||
}
|
||||
|
||||
|
||||
public function isEmptyValue(CustomField $customField, $fields, $slug = null)
|
||||
public function isEmptyValue($fields, CustomField $customField)
|
||||
{
|
||||
return $this->container->get('chill.custom_field.helper')
|
||||
->isEmptyValue($fields, $customField);
|
||||
|
@ -102,4 +102,27 @@ class CustomFieldRenderingTwigTest extends KernelTestCase
|
||||
$this->assertContains('My tailor is rich', $text,
|
||||
"The rendering text should contains the 'test' text");
|
||||
}
|
||||
|
||||
public function testIsEmpty()
|
||||
{
|
||||
$cf = $this->getSimpleCustomFieldText();
|
||||
|
||||
// value is not empty
|
||||
$fields = array(
|
||||
'test' => "My tailor is rich"
|
||||
);
|
||||
|
||||
$result = $this->cfRendering->isEmptyValue($fields, $cf);
|
||||
|
||||
$this->assertFalse($result);
|
||||
|
||||
// value is empty
|
||||
$fields = array(
|
||||
'text' => ''
|
||||
);
|
||||
|
||||
$result = $this->cfRendering->isEmptyValue($fields, $cf);
|
||||
|
||||
$this->assertTrue($result);
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user