/** * * Fixes the element description in-place. * * @param array &$elem The element to work with. * * @param string $name The original element name (column name). * * @param string $col The column definition used to inform the element. * * @return void * */ protected function _fixElementDescr(&$elem, $name, $col) { if ($elem['descr'] !== null) { return; } // if no label specified, set up based on element name $elem['descr'] = $this->_model->locale(strtoupper("DESCR_{$name}")); }
/** * * Filter the data. * * @param Solar_Filter $filter Use this filter instead of the default one. * When empty (the default), uses the default filter for the record. * * @return void * */ public function filter($filter = null) { // pre-filter hook $this->_preFilter(); // filter object if ($filter) { // do not free external filter $free = false; } else { // use default filter, free when done $filter = $this->newFilter(); $free = true; } // apply filters $valid = $filter->applyChain($this); // retain invalids $invalid = $filter->getChainInvalid(); // free the filter? if ($free) { $filter->free(); } // reclaim memory unset($filter); // was it valid? if (!$valid) { // use custom validation messages per column when available foreach ($invalid as $key => $old) { $locale_key = "INVALID_" . strtoupper($key); $new = $this->_model->locale($locale_key); if ($new != $locale_key) { $invalid[$key] = $new; } } $this->_invalid = $invalid; throw $this->_exception('ERR_INVALID', $this->_invalid); } // post-logic, and done $this->_postFilter(); }
/** * * Overrides normal locale() to use the **model** locale strings. * * @param string $key The key to get a locale string for. * * @param string $num If 1, returns a singular string; otherwise, returns * a plural string (if one exists). * * @param array $replace An array of replacement values for the string. * * @return string The locale string, or the original $key if no * string found. * */ public function locale($key, $num = 1, $replace = null) { return $this->_model->locale($key, $num, $replace); }