/**
  * @return bool
  */
 public function Required()
 {
     if ($this->form && ($validator = $this->form->getValidator())) {
         return $validator->fieldIsRequired($this->name);
     }
     return false;
 }
 /**
  * Builds a Form that mirrors the parent editForm, but with an extra field to collect the ChangeSet ID
  *
  * @param DataObject $object The object we're going to be adding to whichever ChangeSet is chosen
  * @return Form
  */
 public function Form($object)
 {
     $inChangeSets = array_unique(ChangeSetItem::get_for_object($object)->column('ChangeSetID'));
     $changeSets = $this->getAvailableChangeSets()->map();
     $campaignDropdown = DropdownField::create('Campaign', '', $changeSets);
     $campaignDropdown->setEmptyString(_t('Campaigns.AddToCampaignFormFieldLabel', 'Select a Campaign'));
     $campaignDropdown->addExtraClass('noborder');
     $campaignDropdown->addExtraClass('no-chosen');
     $campaignDropdown->setDisabledItems($inChangeSets);
     $fields = new FieldList([$campaignDropdown, HiddenField::create('ID', null, $this->data['ID']), HiddenField::create('ClassName', null, $this->data['ClassName'])]);
     $form = new Form($this->controller, $this->name, $fields, new FieldList($action = AddToCampaignHandler_FormAction::create()));
     $action->addExtraClass('add-to-campaign__action');
     $form->setHTMLID('Form_EditForm_AddToCampaign');
     $form->loadDataFrom($this->data);
     $form->getValidator()->addRequiredField('Campaign');
     $form->addExtraClass('form--no-dividers add-to-campaign__form');
     return $form;
 }