- Issue created by @couloir007
- Status changed to Fixed
over 1 year ago 1:04pm 14 June 2023 - π³π±Netherlands megachriz
How to add configuration fields on the feed type for a custom fetcher
- In the annotation of your custom fetcher plugin, set a class for form > configuration:
/** * Defines an HTTP fetcher. * * @FeedsFetcher( (...) * form = { * "configuration" = "Drupal\feeds\Feeds\Fetcher\Form\HttpFetcherForm", (...) */
- Implement the form class. If your fetcher works in a similar way as an existing fetcher, you could extend an existing fetcher form. Else extend
\Drupal\feeds\Plugin\Type\ExternalPluginFormBase
. - In your module's config/schema folder add config schema for your fetcher plugin:
# Fetcher configurations. feeds.fetcher.myfetcher: type: mapping label: 'My fetcher settings' mapping: foo: type: string
From the above example, change fetcher name and mappings accordingly.
How to add source fields to choose from on the mapping form
If you want additional predefined sources to appear on the mapping form, implement
getMappingSources()
. I've written a parser where I used configuration from the fetcher. You could use that technique to get the details you need for connecting to the SharePoint API and then query the SharePoint List.$fetcher = $this->feedType->getFetcher(); $server_id = $fetcher->getConfiguration('server_id'); $getconnector = $fetcher->getConfiguration('getconnector');
(That code does make the assumption of what fetcher is being used, so that would error if you try to combine it with other fetchers. So for making it foolproof, you may want to add some checks to see if the parser is combined with a compatible fetcher).
See also the code attached in the zip for more context about the above idea.Does this help you further? If not, feel free to reopen this issue.
- In the annotation of your custom fetcher plugin, set a class for form > configuration:
Automatically closed - issue fixed for 2 weeks with no activity.