Problem/Motivation
I am trying to programmaticaly substitute values inside the "headers" field or "post_parameter" fieldset provided by this module when creating a new feed, but I can't access it.
What tokens should I use to set the values of
- config>x-default>fetcher>headers
- config>x-default>fetcher>post_parameter
here?

Is it possible at all?
I guess not since I've already tried on similar fields provided by similar module feeds_fetcher_headers
(see here: https://www.drupal.org/project/eca/issues/3309212#comment-14858852)
and there are no tokens listed for [feeds:config] (it doesn't exist).
Proposed resolution
Maybe those config items need to be registered somewhere? I'm not an expert :(
Using config_inspector module I can see there is no configuration data regarding httpfetcherpost's fetcher_configuration:

Thank you 🙏🏻
| Comment | File | Size | Author |
|---|---|---|---|
| #13 | http_fetcher_post.schema.yml | 408 bytes | sleitner |
| #9 | fetcher_configuration error missing schema.png | 27.3 KB | kopeboy |
| #3 | httpfetcherpost configuration - feeds-form-alter.png | 204.41 KB | kopeboy |
| feed-form-config-fetcher.png | 74.26 KB | kopeboy |
Comments
Comment #2
kopeboyComment #3
kopeboyComment #4
kopeboyComment #5
kopeboyConfig inspector is even signaling an error "missing schema" for the fetcher_configuration on any feed where I've enabled this module's fetcher.
Maybe that's the cause I can't set the values programmatically? 🤨
Comment #6
sleitner commentedI'm not sure what you want to do exactly? In PHP or in the Drupal backend UI?
To change something in a Drupal/feed/Entity/Feed object, you should load the entity and use the functions of its class. Never change values directly. Maybe you can do this in the debugger, but this is not the way PHP works.
Tokens are read only.
These values are not in config, they are in the Feed entity object.
Feed-URL, Headers, POST parameters are not part of the Feedtype configuration.
Feeds_fetcher_post module is an plugin for the Feeds module and it only uses its methods.
Comment #7
kopeboyI'm trying to set the values of the headers and post parameters fields using ECA (which is a module similar to Rules).
On the feed type I have fields that hold the values I need and I'm trying to substitute them when the feed form is saved.
Just like I would do with form_alter & form_submit, but (through ECA module) in a more flexible way and without coding custom modules.
I can already substitute the feed source, but the same method is not working for the form fields provided by this module.
Comment #8
sleitner commentedThe module reads the config from the feed through this function:
$feed_config = $feed->getConfigurationFor($this->plugin);and writes it with this function:
$feed->setConfigurationFor($this->plugin, $feed_config);I'm not familiar with ECA, I guess you have to ask your questions there.
Comment #9
kopeboyI'm returning here because I have issues ONLY when I use the fetcher provided by this module AND by feeds_fetcher_headers module
Your module is inspired by that, so I guess it's not a coincidence.
I repeat: even without creating any feed, just creating a feed_type with the fetcher:
- Download from URL additional POST parameters (this module)
- Download from URL additional Headers (inspiring module)
throws one error at /admin/reports/status#error
"The site's configuration does not match the associated schema."
for each of the feed_types using said fetchers.
At admin/reports/config-inspector/feeds.feed_type.MY_FEED_TYE/list you can see this:
That, I think, makes me unable to target the feed.config.fetcher properties/values programmatically (with ECA).
Trying to edit the feed.config.fetcher.post_parameter creates a value in
feed.config.post_parameter:MY_VALUEinstead offeed.config.fetcher.post_parameter:MY_VALUEComment #10
kopeboyComment #11
kopeboyNow I'm stuck with errors, I cannot even content types that referenced to entity types that were referenced in a feed created with the fetcher from this module.
Apparently without a proper schema my past feeds were not deleted correctly, the error I get is:
RuntimeException: Adding non-existent permissions to a role is not allowed. The incorrect permissions are "clear own MY_DELETED_FEED_TYPE feeds", "create MY_DELETED_FEED_TYPE feeds", "delete own MY_DELETED_FEED_TYPE feeds", "import own MY_DELETED_FEED_TYPE feeds", "schedule_import own MY_DELETED_FEED_TYPE feeds", "update own MY_DELETED_FEED_TYPE feeds", "view MY_DELETED_FEED_TYPE feeds". in Drupal\user\Entity\Role->calculateDependencies() (line 206 of /var/www/html/web/core/modules/user/src/Entity/Role.php).Not sure if this permission issue depends on a Core bug though..
Comment #12
kopeboyI leave this here in case it can help others:
I was able to fix the error by
Comment #13
sleitner commentedI'm not a config schema expert. Feel free to test the attached file.
Comment #14
sleitner commentedFile is added in 1.2.0-alpha1