bluehousegroup / silverstripe-pardot

BSD 3-Clause "New" or "Revised" License
4 stars 5 forks source link

Provide elemental block type for pardot form #15

Open sminnee opened 5 years ago

sminnee commented 5 years ago

In an elemental block-based site (which is an pattern of site that we're promoting in SS4) it would make sense if there was a block that you could insert that provided a Pardot form.

This would probably be in addition to the current TinyMCE button rather than instead.

It's not immediately clear if this is best done with a "dormant" class that is only accessed if elemental is installed, or whether is' better to have a separate 'silverstripe-elemental-pardot' module that provides the link between the two.

madmatt commented 5 years ago

silverstripe/blog does it via class_exists to provide additional functionality when using the widgets module, but not requiring that module to work. Is this sort of what you're thinking of?

I'm somewhat surprised that it works (I thought the use statements would complain), but it seems to work fine.

For example: https://github.com/silverstripe/silverstripe-blog/blob/master/src/Widgets/BlogArchiveWidget.php

OTOH, dnadesign/silverstripe-elemental-userforms seems to suggest the recommended approach is to do it via a third module that joins the two together (e.g. requires both elemental and userforms).

sminnee commented 5 years ago

I spoke with @scopeynz who does a lot of elemental maintenance for us and recommended this approach (like Blog). So I think I'll go with that – it's in keeping with elemental being seen as a "more core" part of SS4 in the future.

use DNADesign\Elemental\Models\BaseEement;

if (!class_exists(BaseElement::class)) {
    return;
}

class PardotFormBlock extends BaseElement 

I'll raise a PR>