*/ /** * patTemplate modifier Locale * * Load column from database. The value should be the table's primary key * * Parameter: * - table, name of table to load from * - column, which column to display * * @package patTemplate * @package Modifiers * @author gERD Schaufelberger */ class patTemplate_Modifier_Data extends patTemplate_Modifier { /** * shared table object * @var WBDatasource_Table */ static protected $_table = null; /** * modify the value * * @access public * @param string value * @return string modified value */ public function modify( $value, $params = array() ) { if( !isset( $params['table'] ) || !isset( $params['column'] ) ) { return $value; } if (0 == intval($value)) { return ''; } $table = $params['table']; $id = $value; // load table object if( !self::$_table ) { self::$_table = WBClass::create( 'WBDatasource_Table' ); } $list = self::$_table->get($table, $id); if (empty($list)) { return ''; } return $list[0][$params['column']]; } }