You are here

abstract class field_timer_formatter_js_base in Field Timer 7.2

Base class for formatters using js library.

Hierarchy

Expanded class hierarchy of field_timer_formatter_js_base

File

includes/field_timer_base.inc, line 101
Contains base help classes to perform field formatter related actions.

View source
abstract class field_timer_formatter_js_base extends field_timer_formatter_base {
  protected $library_loaded = FALSE;

  /**
   * Get jQuery plugin name.
   *
   * @return string Plugin name.
   */
  public abstract function getPluginName();

  /**
   * Load library files.
   *
   * @return bool Indicate if library files loaded successfully.
   */
  protected abstract function loadLibrary();

  /**
   * Load custom JS and CSS files and JS settings.
   *
   * @param @see hook_field_formatter_view().
   */
  protected function loadJSandCSS($entity_type, $entity, $field, $instance, $langcode, $items, $display) {
    $js_settings = $this
      ->generateJSSettings($entity_type, $entity, $field, $instance, $langcode, $items, $display);
    drupal_add_js(array(
      'field_timer' => $js_settings,
    ), 'setting');
    drupal_add_js(drupal_get_path('module', 'field_timer') . '/js/field_timer.js');
  }

  /**
   * Generate JS settings.
   *
   * @param @see hook_field_formatter_view().
   *
   * @return array Drupal JS settings array.
   */
  protected abstract function generateJSSettings($entity_type, $entity, $field, $instance, $langcode, $items, $display);

}

Members

Namesort descending Modifiers Type Description Overrides
field_timer_formatter_base::getTimestamp abstract protected function Convert field item value to timestamp. 16
field_timer_formatter_interface::enableFormatter public function Check if it is possible to enable current formatter. 3
field_timer_formatter_interface::getDefaultSettings public function Get default formatter settings. All settings for each field type will be combined into one array. 4
field_timer_formatter_interface::getFieldType public function Get field type. 16
field_timer_formatter_interface::getFormatterDefinition public function Get formatter definition. 4
field_timer_formatter_interface::getFormatterName public function Get formatter name. 4
field_timer_formatter_interface::getSettingsForm public function Get formatter settings form. 4
field_timer_formatter_interface::getSettingsSummary public function Get formatter settings summary. 4
field_timer_formatter_interface::renderItems public function Render field items. 4
field_timer_formatter_js_base::$library_loaded protected property
field_timer_formatter_js_base::generateJSSettings abstract protected function Generate JS settings. 2
field_timer_formatter_js_base::getPluginName abstract public function Get jQuery plugin name. 3
field_timer_formatter_js_base::loadJSandCSS protected function Load custom JS and CSS files and JS settings. 1
field_timer_formatter_js_base::loadLibrary abstract protected function Load library files. 2