@@ -6,7 +6,7 @@ class UserProfilesPlugin extends Omeka_Plugin_AbstractPlugin
66{
77
88 protected $ _hooks = array (
9- 'install ' ,
9+ 'install ' ,
1010 'uninstall ' ,
1111 'define_acl ' ,
1212 'config ' ,
@@ -22,7 +22,8 @@ class UserProfilesPlugin extends Omeka_Plugin_AbstractPlugin
2222 protected $ _filters = array (
2323 'admin_navigation_main ' ,
2424 'search_record_types ' ,
25- 'api_resources '
25+ 'api_resources ' ,
26+ 'api_import_omeka_adapters '
2627 );
2728
2829 protected $ _options = null ;
@@ -190,6 +191,32 @@ public function filterApiResources($resources, $arg)
190191 return $ resources ;
191192 }
192193
194+ public function filterApiImportOmekaAdapters ($ adapters , $ args )
195+ {
196+ // Sequence is important here. Need the types and their elements mapped in first
197+ // Then the profiles themselves, then bring in the multi-valued elements then their values
198+ $ typesAdapter = new ApiImport_ResponseAdapter_Omeka_GenericAdapter (null , $ args ['endpointUri ' ], 'UserProfilesType ' );
199+ $ typesAdapter ->setResourceProperties (array ('element_set ' => 'ElementSet ' ));
200+ $ adapters ['user_profiles_types ' ] = $ typesAdapter ;
201+
202+ $ elementAdapter = new ApiImport_ResponseAdapter_Omeka_GenericAdapter (null , $ args ['endpointUri ' ], 'UserProfilesMultiElement) ' );
203+ $ elementAdapter ->setResourceProperties (array ('element_set ' => 'ElementSet ' ));
204+ $ adapters ['user_profiles_multielements ' ] = $ elementAdapter ;
205+
206+ $ profileAdapter = new ApiImport_ResponseAdapter_Omeka_UserProfilesProfile (null , $ args ['endpointUri ' ], 'UserProfilesProfile ' );
207+ $ adapters ['user_profiles ' ] = $ profileAdapter ;
208+
209+ $ valueAdapter = new ApiImport_ResponseAdapter_Omeka_GenericAdapter (null , $ args ['endpointUri ' ], 'UserProfilesMultiValue ' );
210+ $ valueAdapter ->setResourceProperties (array (
211+ 'profile_type ' => 'UserProfilesType ' ,
212+ 'multi ' => 'UserProfilesMultiValue ' ,
213+ 'profile ' => 'UserProfilesProfile '
214+ ));
215+ $ adapters ['user_profiles_multivalues ' ] = $ valueAdapter ;
216+
217+ return $ adapters ;
218+ }
219+
193220 public function hookPublicItemsShow ($ args )
194221 {
195222 if (get_option ('user_profiles_link_to_owner ' )) {
0 commit comments