Use Drupal Services to perform CRUD operations on Entityforms.Because Entityforms are standard Drupal entities you can also:.Flexible and customizable through the UI.Uses Rules, allowing for complex conditions and actions to be performed on Entities, including sending notifications.Form Submissions are available to Views allowing you to create flexible reports, views and submission data exports. The allows you to make forms look and behave just the way you want.īesides being able to use any Drupal fields, some other features of the Entityform module include: With the Entityform module the field options available for creating your forms are substantially increased. The Conditional Fields module can be used to dynamically hide, show and make required fields within your form to create complex if/then scenarios for showing fields and creating dependencies.Īnother option is the ability to use the Field Permissions module to control access to fields on an Entityform. It even works with the Inline Entity Form module to create a very nice widget for adding multiple referenced entities to a form! Link/URL fields, Field Collections and Phone Number fields are few other possibilities using the Entityform module. Other field examples include Entity Reference fields to reference Node, User and other Entities. For example, you can create a form using the Address Field module to collect user addresses with properly formatted address fields that change dynamically for each country the user may select. The Entityform module allows you to build forms using any available fields from Drupal core or contributed modules. This is where the Entityform module is most useful. However, because the Webform module is restricted to the basic field types that are included with it, as popular as the Webform module is, it is also limiting in the type of fields that you can use to collect your user data.Īlthough the fields included with Webform are often all you need for many basic forms, there are many situations where you may need additional field types that are not possible with the Webform module. If you're not familiar with field collections, try to first digest the answer to " this question".The popular Webform module has been the longtime standard for creating surveys, applications, registrations and other types of forms used for collecting information from users on Drupal websites. Īfter adding a price of 2.45 for field collection item with id 1, subtotal is 2.45.Īfter adding a price of 9.15 for field collection item with id 2, subtotal is 11.60.Īfter adding a price of 1.23 for field collection item with id 4, subtotal is 16.23. the Drupal messages that are shown: Drupal calculator started. Here is a sample of my test results, i.e. So that only item 2 and 3 (without its last sub-bullet) is left as Rules Actions. After you're convinced it works as it should, just remove all Rules Actions with Show a message on the site. Obviously, this rule is rather a prototype. The Total price for all prices included as field collection items is 26.23. Show a message on the site, with a message like so:Īfter adding a price of 3.40 for field collection item with id 3, subtotal is 15.00. Remark: not sure (not tested), but maybe this calculation_result variable can be replaced straight by total_price (in the previous action), so that you would not need this action. Set a data value, which simply copies the value stored in variable calculation_result in my total_price (defined in Rules Action 2 above). Show a message on the site, with a message like so:Īdd a variable, whereas it is a variable named total_price, decimal (2 digits), initial value 0.Īdd a loop, to iterate over each item of my field collection field (with machine name field_article_details), and perform these Rules Actions for each iteration:Ĭalculate a value, which calculates the sum of total_price (defined in Rules Action 2 above) and article-details-item:field-price (this is the machine name of the field in the field collection that contains the prices, decimal with 2 digits), and stores the result (sum) in variable calculation_result.Wake up, here is where the magic (fun?) is going to happen. Rules Condition:Įntity has field, whereas the entity is "node", and the machine name of my field collection field is field_article_details (adapt this machine name to whatever fits, but make sure you use the field collection field itself). Rules Event:Ĭontent is viewed (of type Article), adapt the machine name of the content type article to whatever fits (or use any other Rules Event that fits). Some more details about this rule are below. Processing Field collection items with Rules is fun, really! Have a look at this Rule (in Rules export format):
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |