本文整理汇总了PHP中Formo::config方法的典型用法代码示例。如果您正苦于以下问题:PHP Formo::config方法的具体用法?PHP Formo::config怎么用?PHP Formo::config使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Formo
的用法示例。
在下文中一共展示了Formo::config方法的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: label
/**
* Retrieve the label text
*
* @access public
* @return void
*/
public function label($utf8 = FALSE)
{
$label = ($label = $this->_field->get('label'))
? $label
: $this->_field->alias();
// Translate if needed
return (Formo::config($this->_field, 'translate') === TRUE)
? __($label)
: $label;
}
示例2: _add_input_rules
protected function _add_input_rules()
{
// Grab the rules from the formo config
$rules = Formo::config($this->_field, 'input_rules.' . $this->get_type());
if ($rules) {
// Attach rules to the field's parent
$this->_field->parent()->rules($this->_field->alias(), $rules);
}
if ($bindings = Formo::config($this->_field, 'formo.html5_bindings.' . $this->get_type())) {
$this->_field->set('bindings', $bindings);
}
}
示例3: translate
public function translate($str)
{
$new_str = $str;
if (Formo::config($this->_field, 'use_messages') === TRUE) {
$msg_file = Formo::config($this->_field, 'message_file');
$new_str = Kohana::message($msg_file, $str, $str);
}
if (Formo::config($this->_field, 'translate') === TRUE) {
$new_str = __($new_str);
}
return $new_str;
}
示例4: message_file
public function message_file()
{
return Formo::config($this, 'message_file');
}
示例5: _get_view_prefix
protected function _get_view_prefix($prefix = NULL)
{
// If the specified prefix is FALSE, no prefix
if ($prefix === FALSE) {
return FALSE;
}
// If the prefix was specified, use it
if ($prefix !== NULL) {
return rtrim($prefix, '/');
}
// Find the appropriate view_prefix
$prefix = $this->_field->get('view_prefix', NULL);
if ($prefix === NULL) {
$prefix = ($parent = $this->_field->parent()) ? $parent->get('view_prefix', NULL) : NULL;
// Set the view prefix so children can use it
$this->_field->set('view_prefix', $prefix);
}
// If prefix is still set to NULL and config file has one defined, use the config prefix
if ($prefix === NULL and $_prefix = Formo::config($this->_field, 'view_prefix')) {
$prefix = $_prefix;
}
return $prefix;
}
示例6: _get_message_file
protected function _get_message_file($file)
{
if ($file === NULL)
{
$file = Formo::config($this, 'message_file');
}
return $file;
}
示例7: _add_options
/**
* Add options for relational fields (checkboxes, radios, select options)
*
* @access protected
* @param mixed ORM $query
* @param mixed array & $options
* @return void
*/
protected function _add_options($alias, ORM $query, array & $options)
{
// First check to see if there are any query options to limit the records
if ($limit = $this->_form->$alias->get('records'))
{
$query = $limit($query);
}
// Create the array
$opts = array();
foreach ($query->find_all() as $row)
{
$primary_key = $row->primary_key();
$primary_val = Formo::config($this->_form->$alias, 'orm_primary_val');
// Use the primary value
$opts[$row->{$primary_val}] = $row->{$primary_key};
}
// Add the options to the field
$options['options'] = $opts;
}
示例8: orm_driver
/**
* Load an orm driver instance
*
* @access public
* @param mixed $save_instance. (default: FALSE)
* @return Formo_ORM object
*/
public function orm_driver($save_instance = TRUE)
{
if (!$this instanceof Formo_Form) {
return $this->parent()->orm_driver(TRUE);
}
if ($instance = $this->get('orm_driver_instance')) {
// If the instance exists, return it
return $instance;
}
// Get the driver neame
$driver = Formo::config($this, 'orm_driver');
// Create the new instance
$instance = new $driver($this);
if ($save_instance === TRUE) {
// Save the instance if asked to
$this->set('orm_driver_instance', $instance);
}
$this->_loaded['orm'] = TRUE;
// REturn the new orm driver instance
return $instance;
}
示例9: close
public function close()
{
$singletag = in_array($this->_vars['tag'], $this->_singles);
// Let the config file determine whether to close the tags
$closetag = Formo::config($this->_field, 'close_single_html_tags') === TRUE ? '/' : NULL;
if ($singletag === TRUE) {
return $closetag . '>' . "\n";
} else {
return '</' . $this->_vars['tag'] . '>' . "\n";
}
}
示例10: __toString
/**
* Renders the form according to the config file's "render" setting
*
* @access public
* @return void
*/
public function __toString()
{
// Render as the default render type
return $this->render(Formo::config($this, 'render_type'));
}
示例11: __toString
/**
* Renders the form according to the config file's "render" setting
*
* @access public
* @return void
*/
public function __toString()
{
// Render as the default render type
try {
return $this->render(Formo::config($this, 'render_type'));
} catch (Exception $e) {
return "Error rendering form:" . $e->getMessage();
}
}