/** * {@inheritdoc} */ public function buildForm(array $form, FormStateInterface $form_state, $entry_id = NULL) { try { $this->entry = BlacklistStorage::getEntry($entry_id); } catch (\Exception $e) { drupal_set_message(t('There was an error loading the entry to delete.')); return array(); } if (empty($this->entry)) { drupal_set_message(t('There was an error loading the entry to delete.')); return array(); } $form = parent::buildForm($form, $form_state); return $form; }
/** * Loads a blacklist entry by id and saves it to the class variable. * * @param $entry_id * The id of the blacklist entry * @return array * The blacklist entry data (or data for a blank entry) */ private function loadByEntryId($entry_id = NULL) { if (is_null($entry_id)) { return array(); } $this->setEntry(BlacklistStorage::getEntry($entry_id)); return $this->getEntry(); }