Favorites Documentation

Favorites:Collection_Form template tag

The Favorites:Collection_Form tag is used to display a form that allows your users to add and update collections for channel entries or members.

It's highly recommended that this form be limited for use only by administrators. This can be done by wrapping the form template tag in a conditional that checks to make sure the currently logged in user is part of an Admin member group.

{exp:favorites:collection_form} content {/exp:favorites:collection_form}

Parameters

The following parameters are available for use:

form:ATTRIBUTE_NAME=

form:class="your_class_name"

This parameter allows you to control any form attribute for the form in your template. Simply replace ATTRIBUTE_NAME with an attribute name such as id, name, class, onsubmit, etc, and specify a value for that attribute. You can specify this parameter multiple times to control as many attributes as necessary. This would normally be done to control your form with Javascript or style it with CSS.

type=

type="entry"

This parameter sets which kind of collection to create. There are 2 options for the type parameter:

  • entry (default) - for collections used with channel entries
  • member - for collections used with members

edit_mode

edit_mode="yes"

This parameter puts the form in Edit Mode, which allows updating the favorite's collection name. Along with this parameter, a collection ID is required and must be provided through the collection_id parameter.

collection_id=

collection_id="123"

This parameter is used in conjuction with the edit_mode parameter. This value is needed to let Favorites know which collection to edit. The collection ID is available from the Favorites:Collections tag.

return

return="template_group/template_name"

This parameter determines where to send users once they have submitted the form. If this parameter is not called, the form will return the current page.

error_page

error_page="path_to/template"

This parameter allows you to bypass the EE message template for displaying errors, and instead show your own regular template with the error messages. Your error template must follow guidelines mentioned in the Favorites Error Page documentation.

Form Fields

The following form fields are available for use:

collection

<input type="text" name="collection" />

This form field is necessary for supplying or editing a collection's name. When editing a collection name, use the Favorites:Collections tag to populate the existing data.

Examples

The following is an example of how you would create a form that allows users to create new entry collections on the front end. NOTE: it's highly recommended that this form be limited for use only by administrators. This can be done by wrapping the form template tag in a conditional that checks to make sure the currently logged in user is part of an Admin member group.

{exp:favorites:collection_form
    type="entry"
}
    <input type="input" name="collection" />
    <input type="submit" name="submit" value="Add" />
{/exp:favorites:collection_form}

The following is an example of how you would edit existing entry collections:

<ul>
{exp:favorites:collections
    type="entry"
}
    <li>
        {exp:favorites:collection_form
            type="entry"
            collection_id="{favorites:collection_id}"
        }
            <input type="input" name="collection" value="{favorites:collection_name}" />
            <input type="submit" name="submit" value="Update" />
        {/exp:favorites:collection_form}
    </li>
{/exp:favorites:collections}
</ul>

Support

Having problems setting up and/or using Favorites? Support is offered from 10am to 4pm EST weekdays. Send us an email at help@eeharbor.com and we will respond as quickly as we can.