public function updateEditForm(Form $form) { if (($record = $form->getRecord()) instanceof SiteTree) { if (!$record->numChildren()) { return; } } Requirements::javascript(THIRDPARTY_DIR . '/jquery/jquery.js'); Requirements::javascript('siteexporter/javascript/SiteExportAdmin.js'); $action = new FormAction('doExport'); $action->useButtonTag = true; $action->setButtonContent('Export'); $exports = new TableListField('SiteExports', 'SiteExport', null, sprintf('"ParentClass" = \'%s\' AND "ParentID" = %d', ClassInfo::baseDataClass($form->getRecord()->class), $form->getRecord()->ID)); $exports->setFieldFormatting(array('Archive.Name' => '<a href=\\"{$Archive()->Link()}\\">{$Archive()->Name}</a>')); $exports->setForm($form); $fields = array(new HeaderField('ExportSiteHeader', 'Export Site As Zip'), new OptionSetField('ExportSiteBaseUrlType', 'Base URL type', array('fixed' => 'Set the site base URL to a fixed value', 'rewrite' => 'Attempt to rewrite URLs to be relative'), 'fixed'), new TextField('ExportSiteBaseUrl', 'Base URL', Director::absoluteBaseURL()), new DropdownField('ExportSiteTheme', 'Theme', SiteConfig::current_site_config()->getAvailableThemes(), null, null, '(Use default theme)'), $action, new HeaderField('SiteExportsHeader', 'Site Exports'), $exports); $form->Fields()->addFieldsToTab('Root.Export', $fields); if (class_exists('QueuedJobService')) { $form->Fields()->addFieldToTab('Root.Export', new LiteralField('ExporSiteQueuedNote', '<p>The site export' . ' will not be performed immediately, but will be ' . ' processed in the background as a queued job. You can' . ' enter an email address below to send a notification' . ' email to when the job is complete:</p>'), 'action_doExport'); $email = new EmailField('ExportSiteCompleteEmail', 'Notification email address'); $email->setForm($form); $form->Fields()->addFieldToTab('Root.Export', $email, 'action_doExport'); } }