Tripal
Loading...
Searching...
No Matches
Public Member Functions | List of all members
Drupal\tripal\TripalPubLibrary\Interfaces\TripalPubLibraryInterface Interface Reference
Inheritance diagram for Drupal\tripal\TripalPubLibrary\Interfaces\TripalPubLibraryInterface:
Inheritance graph
[legend]
Collaboration diagram for Drupal\tripal\TripalPubLibrary\Interfaces\TripalPubLibraryInterface:
Collaboration graph
[legend]

Public Member Functions

 form (array $form, \Drupal\Core\Form\FormStateInterface &$form_state)
 
 formSubmit (array $form, \Drupal\Core\Form\FormStateInterface &$form_state)
 
 formValidate (array $form, \Drupal\Core\Form\FormStateInterface &$form_state)
 
 run (array $query)
 
 retrieve (array $query, int $limit=10, int $page=0)
 
 parse_xml (string $raw)
 

Detailed Description

Defines an interface for tripal importer plugins.

Member Function Documentation

◆ form()

Drupal\tripal\TripalPubLibrary\Interfaces\TripalPubLibraryInterface::form ( array  $form,
\Drupal\Core\Form\FormStateInterface &  $form_state 
)

Provides form elements to be added for specifying criteria for parsing.

These form elements are added after the file uploader section that is automaticaly provided by the TripalImporter.

Parameters
array$formThe form array definition.
\Drupal\Core\Form\FormStateInterface$form_stateThe form state object.
Returns
array A new form array definition.

Implemented in Drupal\tripal\Plugin\TripalPubLibrary\TripalPubLibraryPubMed.

◆ formSubmit()

Drupal\tripal\TripalPubLibrary\Interfaces\TripalPubLibraryInterface::formSubmit ( array  $form,
\Drupal\Core\Form\FormStateInterface &  $form_state 
)

Handles submission of the form elements.

The form elements provided in the implementation of the form() function can be used for special submit if needed.

Parameters
array$formThe form array definition.
\Drupal\Core\Form\FormStateInterface$form_stateThe form state object.
Returns
void

Implemented in Drupal\tripal\Plugin\TripalPubLibrary\TripalPubLibraryPubMed.

◆ formValidate()

Drupal\tripal\TripalPubLibrary\Interfaces\TripalPubLibraryInterface::formValidate ( array  $form,
\Drupal\Core\Form\FormStateInterface &  $form_state 
)

Handles validation of the form elements.

The form elements provided in the implementation of the form() function should be validated using this function.

Parameters
array$formThe form array definition.*
\Drupal\Core\Form\FormStateInterface$form_stateThe form state object.
Returns
void

Implemented in Drupal\tripal\Plugin\TripalPubLibrary\TripalPubLibraryPubMed.

◆ parse_xml()

Drupal\tripal\TripalPubLibrary\Interfaces\TripalPubLibraryInterface::parse_xml ( string  $raw)

Parses raw xml data and structures it

Receive the raw publication data and formats it into an array that PHP can utilize.

Parameters
string$rawRaw data in xml format
Returns
array $results An array describing the publication created by extracting from the raw data input

Implemented in Drupal\tripal\Plugin\TripalPubLibrary\TripalPubLibraryPubMed.

◆ retrieve()

Drupal\tripal\TripalPubLibrary\Interfaces\TripalPubLibraryInterface::retrieve ( array  $query,
int  $limit = 10,
int  $page = 0 
)

Returns publications from remote publication library.

This function behaves like a pager where you specify the page number you want to return and the number of records you want prepared.

Parameters
array$queryThe criteria used by the parser to retrieve and parse results.
int$limitThe number of publication records to return.
int$pageThe specific page of publication results to retrieve Page values start at 0.
Returns
array|NULL Array with the following keys:
  • 'total_records' = The number of records available for retrieval
  • 'search_str' = The query string used for the search
  • 'pubs' = The uniform publication information array. or returns NULL if the query failed and an exception was caught

Implemented in Drupal\tripal\Plugin\TripalPubLibrary\TripalPubLibraryPubMed.

◆ run()

Drupal\tripal\TripalPubLibrary\Interfaces\TripalPubLibraryInterface::run ( array  $query)

Performs the import.

Parameters
array$queryAn associative array defining a publication query, specifying the database and query parameters for a particular publication repository.
Returns
array|NULL Array with the following keys:
  • 'total_records' = The number of records available for retrieval
  • 'search_str' = The query string used for the search
  • 'pubs' = The uniform publication information array. or returns NULL if the query failed and an exception was caught

Implemented in Drupal\tripal\Plugin\TripalPubLibrary\TripalPubLibraryPubMed.


The documentation for this interface was generated from the following file: