class sep__protocol_formatter
@class Purpose:
Display: Configuration:
Hierarchy
- class \TripalFieldFormatter
- class \ChadoFieldFormatter
- class \sep__protocol_formatter
- class \ChadoFieldFormatter
Expanded class hierarchy of sep__protocol_formatter
2 string references to 'sep__protocol_formatter'
- sep__protocol.inc in tripal_chado/
includes/ TripalFields/ sep__protocol/ sep__protocol.inc - tripal_chado_bundle_instances_info_custom in tripal_chado/
includes/ tripal_chado.fields.inc - Helper function for the hook_create_tripalfield_instance().
File
- tripal_chado/
includes/ TripalFields/ sep__protocol/ sep__protocol_formatter.inc, line 10
View source
class sep__protocol_formatter extends ChadoFieldFormatter {
// The default label for this field.
public static $default_label = 'Protocol';
// The list of field types for which this formatter is appropriate.
public static $field_types =['sep__protocol'];
// The list of default settings for this formatter.
public static $default_settings =[
'setting1' 'default_value'
];
/**
* Provides the field's setting form.
*
* This function corresponds to the hook_field_formatter_settings_form()
* function of the Drupal Field API.
*
* The settings form appears on the 'Manage Display' page of the content
* type administration page. This function provides the form that will
* appear on that page.
*
* To add a validate function, please create a static function in the
* implementing class, and indicate that this function should be used
* in the form array that is returned by this function.
*
* This form will not be displayed if the formatter_settings_summary()
* function does not return anything.
*
* param $field
* The field structure being configured.
* param $instance
* The instance structure being configured.
* param $view_mode
* The view mode being configured.
* param $form
* The (entire) configuration form array, which will usually have no use
* here. Typically for reference only.
* param $form_state
* The form state of the (entire) configuration form.
*
* @return
* A Drupal Form array containing the settings form for this field.
*/
public function settingsForm($view_mode, $form, &$form_state) {
}
/**
* Provides the display for a field
*
* This function corresponds to the hook_field_formatter_view()
* function of the Drupal Field API.
*
* This function provides the display for a field when it is viewed on
* the web page. The content returned by the formatter should only include
* what is present in the $items[$delta]['values] array. This way, the
* contents that are displayed on the page, via webservices and downloaded
* into a CSV file will always be identical. The view need not show all
* of the data in the 'values' array.
*
* @param $element
* @param $entity_type
* @param $entity
* @param $langcode
* @param $items
* @param $display
*
* @return
* An element array compatible with that returned by the
* hook_field_formatter_view() function.
*/
public function view(&$element, $entity_type, $entity, $langcode, $items, $display) {
if (count($items) > 0) {
$protocol_id = $items[0]['value']["protocol_id"];
$protocol_name = $items[0]['value']["protocol_name"];
$content = $protocol_name;
list($entity_type, $entity_id) = explode(':', $items[0]['value']['entity_id']);
if ($entity_id) {
$content = l($protocol_name, 'bio_data/' . $entity_id);
}
}
//cardinality for this field is 1
$element[0] =[
'#type' 'markup'
'#markup' $content
];
}
/**
* Provides a summary of the formatter settings.
*
* This function corresponds to the hook_field_formatter_settings_summary()
* function of the Drupal Field API.
*
* On the 'Manage Display' page of the content type administration page,
* fields are allowed to provide a settings form. This settings form can
* be used to allow the site admin to define how the field should be
* formatted. The settings are then available for the formatter()
* function of this class. This function provides a text-based description
* of the settings for the site developer to see. It appears on the manage
* display page inline with the field. A field must always return a
* value in this function if the settings form gear button is to appear.
*
* See the hook_field_formatter_settings_summary() function for more
* information.
*
* @param $field
* @param $instance
* @param $view_mode
*
* @return string
* A string that provides a very brief summary of the field settings
* to the user.
*
*/
public function settingsSummary($view_mode) {
return '';
}
}
Members
Name | Modifiers | Type | Description |
---|---|---|---|
sep__protocol_formatter:: |
public static | property |
The default lable for this field. Overrides TripalFieldFormatter:: |
sep__protocol_formatter:: |
public static | property |
The list of default settings for this formatter. Overrides TripalFieldFormatter:: |
sep__protocol_formatter:: |
public static | property |
The list of field types for which this formatter is appropriate. Overrides TripalFieldFormatter:: |
sep__protocol_formatter:: |
public | function |
Provides the field's setting form. Overrides TripalFieldFormatter:: |
sep__protocol_formatter:: |
public | function |
Provides a summary of the formatter settings. Overrides TripalFieldFormatter:: |
sep__protocol_formatter:: |
public | function |
Provides the display for a field Overrides TripalFieldFormatter:: |
TripalFieldFormatter:: |
protected | function | Updates a pager generated by theme('pager') for use with AJAX. |
TripalFieldFormatter:: |
protected | function | When constructing a pager for use by a field, all pagers must have a unique ID |
TripalFieldFormatter:: |
public static | function | Provides information about the formatter for this field. |
TripalFieldFormatter:: |
public | function | Instantiates a new TripalFieldFormatter object. |