55use Drupal \Core \Entity \EntityFieldManager ;
66use Drupal \Core \Plugin \ContainerFactoryPluginInterface ;
77use Drupal \ui_patterns \Plugin \PatternSourceBase ;
8- use Drupal \ui_patterns \UiPatternsManager ;
9- use Drupal \Core \TypedData \TypedDataManager ;
108use Symfony \Component \DependencyInjection \ContainerInterface ;
119
1210/**
@@ -33,7 +31,7 @@ class ExtraFieldSource extends PatternSourceBase implements ContainerFactoryPlug
3331 /**
3432 * {@inheritdoc}
3533 */
36- public function __construct (array $ configuration , $ plugin_id , $ plugin_definition , UiPatternsManager $ ui_patterns_manager , TypedDataManager $ typed_data_manager , EntityFieldManager $ entity_field_manager ) {
34+ public function __construct (array $ configuration , $ plugin_id , $ plugin_definition , EntityFieldManager $ entity_field_manager ) {
3735 parent ::__construct ($ configuration , $ plugin_id , $ plugin_definition );
3836 $ this ->entityFieldManager = $ entity_field_manager ;
3937 }
@@ -46,8 +44,6 @@ public static function create(ContainerInterface $container, array $configuratio
4644 $ configuration ,
4745 $ plugin_id ,
4846 $ plugin_definition ,
49- $ container ->get ('plugin.manager.ui_patterns ' ),
50- $ container ->get ('typed_data_manager ' ),
5147 $ container ->get ('entity_field.manager ' )
5248 );
5349 }
@@ -66,15 +62,12 @@ public function getSourceFields() {
6662 }
6763
6864 foreach ($ extra_fields ['display ' ] as $ extra_field_name => $ field ) {
69- if (!$ this ->getContextProperty ('limit ' )) {
70- $ sources [] = $ this ->getSourceField ($ extra_field_name , $ field ['label ' ]);
71- }
72- elseif (in_array ($ extra_field_name , $ this ->getContextProperty ('limit ' ))) {
65+ if (empty ($ this ->getContextProperty ('limit ' )) || in_array ($ extra_field_name , $ this ->getContextProperty ('limit ' ))) {
7366 $ sources [] = $ this ->getSourceField ($ extra_field_name , $ field ['label ' ]);
7467 }
7568 }
7669
7770 return $ sources ;
7871 }
7972
80- }
73+ }
0 commit comments