You are here

function shs_get_class_definitions in Simple hierarchical select 8

Same name and namespace in other branches
  1. 2.0.x shs.module \shs_get_class_definitions()

List all javascript classes used to create models and views in the widget.

Parameters

string $field_name: Name of field to get the definitions for.

array $context: Additional information about the current context (i.e. additional field settings).

Return value

array List of javascript classes keyed by type ("models", "views").

See also

hook_shs_class_definitions_alter()

3 calls to shs_get_class_definitions()
OptionsShsWidget::afterBuild in src/Plugin/Field/FieldWidget/OptionsShsWidget.php
After-build handler for field elements in a form.
ShsChosenTaxonomyIndexTid::valueForm in modules/shs_chosen/src/Plugin/views/filter/ShsChosenTaxonomyIndexTid.php
Options form subform for setting options.
ShsTaxonomyIndexTid::valueForm in src/Plugin/views/filter/ShsTaxonomyIndexTid.php
Options form subform for setting options.

File

./shs.module, line 24
Main functions and methods for the "Simple hierarchical select" module.

Code

function shs_get_class_definitions($field_name, array $context = []) {
  $definitions = [
    'models' => [
      'app' => 'Drupal.shs.AppModel',
      'container' => 'Drupal.shs.ContainerModel',
      'widget' => 'Drupal.shs.WidgetModel',
      'widgetItem' => 'Drupal.shs.WidgetItemModel',
      'widgetItemOption' => 'Drupal.shs.WidgetItemOptionModel',
    ],
    'views' => [
      'app' => 'Drupal.shs.AppView',
      'addNew' => 'Drupal.shs.AddNewView',
      'container' => 'Drupal.shs.ContainerView',
      'widget' => 'Drupal.shs.WidgetView',
      'widgetItem' => 'Drupal.shs.WidgetItemView',
    ],
  ];
  $hooks = [
    'shs_class_definitions',
    "shs_{$field_name}_class_definitions",
  ];

  // Allow other modules to override the list of class definitions.
  \Drupal::moduleHandler()
    ->alter($hooks, $definitions, $context);
  return $definitions;
}