mortgage_calculator.module in Real Estate Mortgage Calculator 8
Same filename and directory in other branches
Mortgage Calculator module file.
File
mortgage_calculator.moduleView source
<?php
/**
* @file
* Mortgage Calculator module file.
*/
use Drupal\mortgage_calculator\MortgageCalculatorCalculation;
/**
* Implements hook_menu().
*/
function mortgage_calculator_menu() {
$items['mortgage-calculator'] = [
'title' => 'Mortgage calculator',
'route_name' => 'mortgage_calculator',
];
return $items;
}
/**
* Implements hook_theme().
*/
function mortgage_calculator_theme($existing, $type, $theme, $path) {
return [
'mortgage_calculator' => [
'variables' => [
'mortgage_calculator_form' => NULL,
'loan_amount' => NULL,
'mortgage_rate' => NULL,
'years_to_pay' => NULL,
'desired_display' => NULL,
],
'path' => drupal_get_path('module', 'mortgage_calculator') . '/templates',
'template' => 'mortgage-calculator',
],
];
}
/**
* Preprocess function.
*/
function template_preprocess_mortgage_calculator(&$variables) {
$mortgage_calculator = new MortgageCalculatorCalculation($variables['loan_amount'], $variables['mortgage_rate'], $variables['years_to_pay'], $variables['desired_display']);
$variables += $mortgage_calculator
->calculate();
}
Functions
Name | Description |
---|---|
mortgage_calculator_menu | Implements hook_menu(). |
mortgage_calculator_theme | Implements hook_theme(). |
template_preprocess_mortgage_calculator | Preprocess function. |