You are here

farm_lab_test.module in farmOS 2.x

The farmOS lab test log module.

File

modules/log/lab_test/farm_lab_test.module
View source
<?php

/**
 * @file
 * The farmOS lab test log module.
 */

/**
 * Allowed values callback function for the lab test type field.
 *
 * @return array
 *   Returns an array of allowed values for use in form select options.
 */
function farm_lab_test_type_field_allowed_values() {

  /** @var \Drupal\farm_lab_test\Entity\FarmLabTestTypeInterface[] $lab_test_types */
  $lab_test_types = \Drupal::entityTypeManager()
    ->getStorage('lab_test_type')
    ->loadMultiple();
  $allowed_values = [];
  foreach ($lab_test_types as $id => $lab_test_type) {
    $allowed_values[$id] = $lab_test_type
      ->getLabel();
  }
  return $allowed_values;
}

Functions

Namesort descending Description
farm_lab_test_type_field_allowed_values Allowed values callback function for the lab test type field.