The Fiona 7 Release Collector

The Fiona 7 release_collector makes it possible to specify custom release patterns for CMS objects. So, for example, if releasing a page should cause some other page to be released as well (e.g. one that isn't referenced), then this functionality can be used to achieve the desired behavior.

The release_collector accepts anything responding to the call method and expects one parameter: obj_id. Thus, it is possible to use a lambda, like so:

Fiona7.release_collector = lambda do |obj_id|
  # ...
end

Alternatively, a class-based implementation may be provided.

It is expected that the release collector returns an array of hashes in the following format:

  [
    {
      # this is a title for a group of objects
      title: 'This title will be shown in the dialog',
      # this is the list of objects presented underneath
      objs: [
        {
          # the ID of the object to be released
          id: 2001,
          # the object's title to be displayed
          title: 'Root',
          # the object's description, typically obj_class
          description: 'RootObj',
          # if "checked" is true, the release checkbox is checked,
          # and no further user input is required for the release
          # to be performed
          checked: true
        }
      ]
    }
  ]

It is possible to define multiple groups and multiple objects in each group.

It is recommended that custom implementations inherit from or delegate to Fiona7::ReleaseCollector, which is the default implementation.