Problem/Motivation

With UI Icons Patterns, having a node with a field type icon, when trying to add 'Data from a field' to slot an error occur and to a prop no source is available.

Steps to reproduce

First problem, Icon field as a slot source

I have a component with a slot and a prop type icon, example here.
I have a node content with an Icon field.
Using UI Patterns Field Formatters.

  • On the node display, I pick my component on a field as 'Component per item'
  • Select the slot > Data from a field
  • Pick the Icon field
  • Console error:
  • Warning: Undefined array key 'sources' in Drupal\ui_patterns\Plugin\UiPatterns\Source\DerivableContextSourceBase->getSourcePlugins() (line 131)
Second problem, Icon field source for a prop type icon
  • On the node display, I pick my component on a field as 'Component per item'
  • select the prop > Source > Data from a field
  • Not available

For this one I guess the problem could be on the IconPropType.php missing something. Any review on that appreciated.

Proposed resolution

I have a quick fix for the first problem, but not sure it's ok, to review.

Command icon 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

mogtofu33 created an issue. See original summary.

pdureau’s picture

Title: Icon as slot or prop » [2.0.0-rc1] Icon as slot or prop
mogtofu33’s picture

Issue summary: View changes
just_like_good_vibes’s picture

Assigned: Unassigned » just_like_good_vibes

hello, i will take this one with you

just_like_good_vibes’s picture

hello, the change proposed is messing up something in the DerivableContextSourceBase,
but the solution is elsewhere.

drupal config required for slots and props is not the same.

for a prop, we have like:

prop_id:
   source_id: xxx
   source:
      ... (source config)

for slots, it is slightly different :

slot_id:
  sources:
    -
       source_id: xxx1
       source:
          ... (source config)
    - 
       source_id: xxx2
       source:
          ... (source config2)

if i am not mistaken, the correction you have posted in the MR is not required.
i am now investigating the rest to help you make it work for ui_icons :)

just_like_good_vibes’s picture

Assigned: just_like_good_vibes » Unassigned
Status: Active » Needs review
mogtofu33’s picture

Assigned: Unassigned » mogtofu33
mogtofu33’s picture

Assigned: mogtofu33 » Unassigned
Status: Needs review » Reviewed & tested by the community

Good for me.

just_like_good_vibes’s picture

Status: Reviewed & tested by the community » Fixed
pdureau’s picture

Title: [2.0.0-rc1] Icon as slot or prop » [2.0.0-beta6] Icon as slot or prop
pdureau’s picture

Status: Fixed » Closed (fixed)