From e64e1e0fb133b6807a9a036c340cd73bc6bf83d3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Julien=20Fastr=C3=A9?= Date: Tue, 29 Dec 2015 16:39:12 +0100 Subject: [PATCH] add doc for `chill_custom_fields_is_empty` --- source/bundles/custom-fields.rst | 34 +++++++++++++++++++------------- 1 file changed, 20 insertions(+), 14 deletions(-) diff --git a/source/bundles/custom-fields.rst b/source/bundles/custom-fields.rst index 508b90f6f..f56b0dc23 100644 --- a/source/bundles/custom-fields.rst +++ b/source/bundles/custom-fields.rst @@ -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 `_ +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`.