/**
  * Gets additional fields to render in the form to add/edit a task
  *
  * @param array $taskInfo Values of the fields from the add/edit task form
  * @param SyncToMailChimpTask $task The task object being edited. Null when adding a task!
  * @param SchedulerModuleController $schedulerModule Reference to the scheduler backend module
  * @return array A two dimensional array, array('Identifier' => array('fieldId' => array('code' => '', 'label' => '', 'cshKey' => '', 'cshLabel' => ''))
  */
 public function getAdditionalFields(array &$taskInfo, $task, SchedulerModuleController $schedulerModule)
 {
     $fields = array();
     $listId = $task != NULL ? $task->getListId() : NULL;
     if (strlen($taskInfo['listId']) > 0) {
         $listId = $taskInfo['listId'];
     }
     $fields['listId'] = array('code' => $this->createListSelection($listId), 'label' => 'LLL:EXT:t3chimp/Resources/Private/Language/locallang_backend.xml:syncToMailChimpTask_label_listId');
     if ($listId != NULL) {
         $code = '';
         $fieldDefinitions = $this->mailChimp->getFieldsFor($listId);
         $existingMappings = $task != NULL ? $task->getMappings() : array();
         foreach ($fieldDefinitions as $fieldDefinition) {
             if ($fieldDefinition['field_type'] != 'address') {
                 $code .= $this->createSimpleField($fieldDefinition, $existingMappings[$fieldDefinition['tag']]);
             } else {
                 $code .= $this->createAddressField($fieldDefinition, $existingMappings);
             }
             $code .= '<br />';
         }
         $groupings = $this->mailChimp->getInterestGroupingsFor($listId);
         foreach ($groupings as $grouping) {
             $code .= $this->createGroupingField($grouping, $existingMappings[$grouping['name']]);
             $code .= '<br />';
         }
         $fields['mappings'] = array('code' => $code, 'label' => 'LLL:EXT:t3chimp/Resources/Private/Language/locallang_backend.xml:syncToMailChimpTask_label_mappings');
     }
     return $fields;
 }
 /**
  * @dontverifyrequesthash
  *
  * @return void
  */
 public function indexAction()
 {
     if ($this->settings['debug']) {
         echo '<!--';
         var_dump($this->mailChimpService->getFieldsFor($this->settings['subscriptionList']));
         echo "\n------------------------\n";
         var_dump($this->mailChimpService->getInterestGroupingsFor($this->settings['subscriptionList']));
         echo '-->';
     }
     if ($this->settings['subscriptionList']) {
         $form = $this->mailChimpService->getForm();
         $this->view->assign('language', $GLOBALS['TSFE']->sys_language_uid);
         $this->view->assign('languageIso', strtolower($GLOBALS['TSFE']->sys_language_isocode));
         $this->view->assign('pageId', $GLOBALS['TSFE']->id);
         $this->view->assign('contentId', $this->configurationManager->getContentObject()->data['uid']);
         $this->view->assign('form', $this->mailChimpService->getForm());
         $this->view->assign('pageType', $this->getPageType());
         $this->signalSlotDispatcher->dispatch(__CLASS__, 'beforeRenderView', array($form, $this->view, $this));
     }
 }