/** * {@inheritdoc} */ public function submitFeedForm(array &$form, FormStateInterface $form_state, FeedInterface $feed) { $feed->setSource($form_state->getValue('source')); }
/** * {@inheritdoc} */ public function submitFeedForm(array &$form, FormStateInterface $form_state, FeedInterface $feed) { // We need to store this for later so that we have the feed id. $new_fid = reset($form_state->getValue('source')); $feed_config = $feed->getConfigurationFor($this); // Generate a UUID that maps to this feed for file usage. We can't depend // on the feed id since this could be called before an id is assigned. $feed_config['usage_id'] = $feed_config['usage_id'] ?: $this->uuid->generate(); if ($new_fid == $feed_config['fid']) { return; } $this->deleteFile($feed_config['fid'], $feed_config['usage_id']); if ($new_fid) { $file = $this->fileStorage->load($new_fid); $this->fileUsage->add($file, 'feeds', $this->pluginType(), $feed_config['usage_id']); $file->setPermanent(); $file->save(); $feed_config['fid'] = $new_fid; $feed->setSource($file->getFileUri()); } $feed->setConfigurationFor($this, $feed_config); }