Poll Plugin Developer Guide - HST Components

Delegation

The Poll plugin provides the standard poll component class  org.onehippo.forge.poll.component.PollComponent, taking care of the processing logic behind voting on and displaying a poll. For the case where your project requires the use of a custom poll component, the Poll plugin has been implemented in such a way that the poll logic is encapsulated in the  org.onehippo.forge.poll.component.PollProvider class, to which the PollComponent delegates. Like this, a custom poll component can easily replace the default PollComponent by delegating to the PollProvider too.

See the default PollComponent for how to delegate the calls to the  doActiondoBeforeRender and  getParameter functions.

Channel Editor Parameter Support

In order for the Channel Editor to be able to render a configuration dialog, your custom poll component should be annotated using the org.onehippo.forge.poll.component.PollDocumentComponentInfo interface. As the parameters are defined and handled in the PollProvider, the PollDocumentComponentInfo interface can be re-used for custom poll components.

@ParametersInfo(type = PollDocumentComponentInfo.class)
public class [...]

Additionally, the custom component should override the getParameter function and delegate it to the PollProvider.

@Override
public String getParameter(String name, HstRequest request) {
    return PollProvider.getParameter(name, (PollComponentInfo)getParametersInfo(request));
}

For more info on see Define a Component's Configuration Parameters and Annotate Channel or Component Configuration Parameters with UI Directives.

Did you find this page helpful?
How could this documentation serve you better?
On this page
    Did you find this page helpful?
    How could this documentation serve you better?