Create an account

Very important

  • To access the important data of the forums, you must be active in each forum and especially in the leaks and database leaks section, send data and after sending the data and activity, data and important content will be opened and visible for you.
  • You will only see chat messages from people who are at or below your level.
  • More than 500,000 database leaks and millions of account leaks are waiting for you, so access and view with more activity.
  • Many important data are inactive and inaccessible for you, so open them with activity. (This will be done automatically)


Thread Rating:
  • 385 Vote(s) - 3.46 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Add Entity Reference to Drupal 8 Form Field?

#1
How can users add products to a simple plugin config using an autocomplete field?

I tried to use Config Entity but it looks the same as Form API (and I can't use entity fields there).
Reply

#2
I was able to do this in Drupal 8 using the form API and the entity_autocomplete type.

$form['stories'] = [
'#type' => 'entity_autocomplete',
'#target_type' => 'node',
'#title' => $this->t('Stories'),
'#description' => $this->t('Select some stories.'),
'#default_value' => $default_entities,
'#tags' => TRUE,
'#selection_settings' => array(
'target_bundles' => array('page', 'article'),
),
'#weight' => '0',
];
Reply

#3
Use [webform][1] - there is an entity reference field.
This won't be useable for your purpose .. but you can check the source for sake.


[1]:

[To see links please register here]

Reply



Forum Jump:


Users browsing this thread:
1 Guest(s)

©0Day  2016 - 2023 | All Rights Reserved.  Made with    for the community. Connected through