add doc for chill_custom_fields_is_empty

This commit is contained in:
Julien Fastré 2015-12-29 16:39:12 +01:00
parent b595efa0c9
commit e64e1e0fb1

View File

@ -284,17 +284,18 @@ For rendering custom fields, two function are available :
* `chill_custom_field_widget` to render the widget. This function is defined on a customFieldType basis.
* `chill_custom_field_label` to render the label. You can customize the label rendering by choosing the layout you would like to use.
* `chill_custom_field_is_empty` indicates if the content of the custom fields is empty (return a boolean)
For rendering custom fields group, a function is available :
* `chill_custom_fields_group_widget` to render the widget. It will display the custom fields of the group in a dd / dt structure.
**chill_custom_field_label**
chill_custom_field_label
^^^^^^^^^^^^^^^^^^^^^^^^
The signature is :
* `CustomField|object|string` **$customFieldOrClass** either a customField OR a customizable_entity OR the FQDN of the entity
* `string` **$slug** only necessary if the first argument is NOT a CustomField instance
* `CustomField` **$customField** a customField instance
* `array` **params** the parameters for rendering. Currently, 'label_layout' allow to choose a different label. Default is 'ChillCustomFieldsBundle:CustomField:render_label.html.twig'
Examples
@ -303,18 +304,16 @@ Examples
{{ chill_custom_field_label(customField) }}
{{ chill_custom_field_label(entity, 'slug') }}
{{ chill_custom_field_label('Path\To\Entity', 'slug') }}
**chill_custom_field_widget**
chill_custom_field_widget
^^^^^^^^^^^^^^^^^^^^^^^^^
The signature is :
* array **$fields** the array raw, as stored in the db
* CustomField|object|string **$customFieldOrClass** either a customField OR a customizable_entity OR the FQDN of the entity
* string **$slug** only necessary if the first argument is NOT a CustomField instance
* CustomField **$customField** a customField instance
* string **$documentType** the type of document. Default to `html`.
Examples:
@ -322,16 +321,23 @@ Examples:
{{ chill_custom_field_widget(entity.customFields, customField) }}
{{ chill_custom_field_widget(entity.customFields, entity, 'slug') }}
chill_custom_field_is_empty
^^^^^^^^^^^^^^^^^^^^^^^^^^^
{{ chill_custom_field_widget(fields, 'Path\To\Entity', 'slug') }}
The signature is :
.. warning::
* array **$fields** the array raw, as stored in the db
* CustomField **$customField** a customField instance
This feature is not fully tested. See `the corresponding issue <https://redmine.champs-libres.coop/issues/283>`_
Examples :
.. code-block:: jinja
{%- if chill_custom_field_is_empty(cFData, customField) == false -%}
**chill_custom_fields_group_widget**
chill_custom_fields_group_widget
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
This function only display custom fields that are `active`.