Problem/Motivation
It would be nice to have some debugging information available relative to feeds information stored in "feeds item" field, if anything is even stored there.
Steps to reproduce
-Navigate to feed item form display (structure/types/manage/YOUR_FEED_NAME_HERE/form-display)
-Scroll down to disabled at the bottom, note the "Feeds item" field, with an empty drop down.
-Drag the "feeds item" field up into the active fields section of the tabledrag.
-Submit, and note PHP error:
Drupal Component Plugin Exception PluginNotFoundException: The "hidden" plugin does not exist. Valid plugin IDs for Drupal\Core Field) WidgetPluginManager are: (etc etc)
Screenshots


Proposed resolution
Establish a feeds item form widget. Ideally if possible have it display useful information to users with the permissions "Administer Feeds"
| Comment | File | Size | Author |
|---|---|---|---|
| #2 | 3389946-1-add-form-widget-for-feeds-item.patch | 982 bytes | jnicola |
| Screen Shot 2023-09-25 at 11.27.59 AM.png | 584.53 KB | jnicola | |
| Screen Shot 2023-09-25 at 11.27.01 AM.png | 72.13 KB | jnicola |
Issue fork feeds-3389946
Show commands
Start within a Git clone of the project using the version control instructions.
Or, if you do not have SSH keys set up on git.drupalcode.org:
Comments
Comment #2
jnicola commentedAttaching a patch version of my initial work from that fork incase folks want to grab this in such a fashion.
All I did was add a field widget. No display handling. I left a TODO in there to eventually display useful debug information for admins, if that's what even is contained in that field?
This no matter what alleviates fatal errors relating to trying to drag that field into form display though!
Comment #3
lolgm commented@jnicola Thanks for the patch.
This problem makes it impossible to translate form display configurations of entities that have the Feeds Item field.
For more detailed information, I explained in comment #282
#2546212-282: Entity view/form mode formatter/widget settings have no translation UI
Comment #4
megachrizA feeds_item field wasn't meant to appear on the "Manage form display" page
The field type "feeds_item" has a "no_ui" property set to
TRUEin its annotation. According to \Drupal\Core\Field\Annotation\FieldType that means:So I assume this should mean that the field isn't supposed to appear on the "Manage form display" page. Could this perhaps be a bug in Drupal Core? Or did I misunderstood the purpose of the "no_ui" property here?
In Drupal Core, the following field types also have "no_ui" set: "changed", "created", "language", "map", "password", "uri" and "uuid". Some do have a default widget, but not all of them. At least some of these field types I don't see either on "Manage form display", like "uuid". So why is it that an "uuid" field on an entity does not cause trouble, but a "feeds_item" field does?
Commit patch as is?
Anyway, I see that the field is displayed on the "Manage form display". So maybe we should commit this patch as is (if it doesn't break any tests). I wasn't aware that it could cause trouble. Thought it was only a minor UX issue when accidentally dragging the field on the form display.
What a feeds_item field contains
A feeds item field contains metadata about the imported entity. It tells when the entity was imported, with which feed entity it was imported and it has a hash value that is used by Feeds to determime if the source item has changed on a subsequent import. The properties "guid" and "url" can be mapped to. Perhaps it is useful to make these two properties editable with a widget.
Comment #5
lolgm commentedno_ui property
From what I can see, the no_ui property in the field annotation is only used to prevent this from being listed when creating a new field in entities (/admin/config/people/accounts/fields/add-field).
Field form display configuration
The only way I know to prevent a field from appearing in the form's display list is to define the entity's base fields.
Eg. bellow: Defining the fields of the Feed entity (feeds_feed), if I didn't want the title field to be displayed in the form display
setDisplayConfigurable('form', FALSE)https://git.drupalcode.org/project/feeds/-/blob/8.x-3.x/src/Entity/Feed....
That being said, it is completely useless in this case...
Feeds item widget
Although I don't see any use case where the feeds item field would be exposed, I think it would be the simplest solution.
Since this field stores internal feed processing information, would it be a good solution to have a readonly option in the widget?
@MegaChriz Thanks for the quick help.