Source of file PardotPage.php
Size: 1,258 Bytes - Last Modified: 2021-12-24T06:33:45+00:00
/var/www/docs.ssmods.com/process/src/src/PardotPage.php
1234567891011121314151617181920212223242526272829303132333435363738394041424344454647 | <?php namespace BluehouseGroup\Pardot; use Pardot_API; use SilverStripe\Control\Controller; use SilverStripe\ORM\ArrayList; /** * * @package SilverStripe-Pardot * @subpackage SilverStripe-Pardot */ class PardotPage extends Controller { /** * This function starts the routine, and is the first function * to execute off the URL accessor (defined in @see _config.php) */ public function index() { $pardot = new Pardot_API(PardotConfig::getPardotCredentials()); $forms_object = $pardot->get_forms(PardotConfig::getPardotCredentials()); $forms = array(); foreach ($forms_object as $form_object) { $forms[]['name'] = $form_object->name; } $forms = new ArrayList($forms); $content_object = $pardot->get_dynamicContent(PardotConfig::getPardotCredentials()); $contents = array(); foreach ($content_object as $content) { $contents[]['name'] = $content->name; } $contents = new ArrayList($contents); return $this->customise(array( 'Forms' => $forms, 'DynamicContent' => $contents ))->renderWith([ 'type' => 'Layout', 'PardotModalForm' ]); } } |