computed_field.module in Computed Field 3.x
Same filename and directory in other branches
Contains computed_field.module.
File
computed_field.moduleView source
<?php
/**
* @file
* Contains computed_field.module.
*/
use Drupal\Core\Entity\EntityInterface;
use Drupal\Core\Routing\RouteMatchInterface;
/**
* Implements hook_help().
*/
function computed_field_help($route_name, RouteMatchInterface $route_match) {
switch ($route_name) {
// Main module help for the computed_field module.
case 'help.page.computed_field':
$output = '';
$output .= '<h3>' . t('About') . '</h3>';
$output .= '<p>' . t('Defines a field type that allows values to be "computed" via PHP code.') . '</p>';
return $output;
default:
}
}
/**
* Implements hook_theme().
*/
function computed_field_theme() {
$theme = [];
return $theme;
}
/**
* Implements hook_entity_presave().
*/
function computed_field_entity_presave(EntityInterface $entity) {
\Drupal::service('computed_field.multiple_values_generator')
->setEntity($entity)
->generateMissingValues();
}
Functions
Name | Description |
---|---|
computed_field_entity_presave | Implements hook_entity_presave(). |
computed_field_help | Implements hook_help(). |
computed_field_theme | Implements hook_theme(). |