本文整理汇总了PHP中Helpers::addClass方法的典型用法代码示例。如果您正苦于以下问题:PHP Helpers::addClass方法的具体用法?PHP Helpers::addClass怎么用?PHP Helpers::addClass使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Helpers
的用法示例。
在下文中一共展示了Helpers::addClass方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: open
/**
* Opens up magically a form
*
* @param string $typeAsked The form type asked
* @param array $parameters Parameters passed
* @return string A form opening tag
*/
public function open($typeAsked, $parameters)
{
$method = 'POST';
$secure = false;
$action = array_get($parameters, 0);
$attributes = array_get($parameters, 1);
// If classic form
if ($typeAsked == 'open') {
$type = Former::$defaultFormType;
} else {
// Look for HTTPS form
if (str_contains($typeAsked, 'secure')) {
$typeAsked = str_replace('secure', null, $typeAsked);
$secure = true;
}
// Look for file form
if (str_contains($typeAsked, 'for_files')) {
$typeAsked = str_replace('for_files', null, $typeAsked);
$attributes['enctype'] = 'multipart/form-data';
}
// Calculate form type
$type = trim(str_replace('open', null, $typeAsked), '_');
if (!in_array($type, $this->availableTypes)) {
$type = Former::$defaultFormType;
}
}
// Add the final form type
$attributes = Helpers::addClass($attributes, 'form-' . $type);
// Store it
$this->type = $type;
// Open the form
return \Form::open($action, $method, $attributes, $secure);
}
示例2: open
/**
* Opens up magically a form
*
* @param string $typeAsked The form type asked
* @param array $parameters Parameters passed
* @return string A form opening tag
*/
public function open($typeAsked, $parameters)
{
$action = array_get($parameters, 0);
$method = array_get($parameters, 1, 'POST');
$attributes = array_get($parameters, 2, array());
$secure = array_get($parameters, 3, false);
// If classic form
if ($typeAsked == 'open') {
$type = Config::get('default_form_type');
} else {
// Look for HTTPS form
if (str_contains($typeAsked, 'secure')) {
$typeAsked = str_replace('secure', null, $typeAsked);
$secure = true;
}
// Look for file form
if (str_contains($typeAsked, 'for_files')) {
$typeAsked = str_replace('for_files', null, $typeAsked);
$attributes['enctype'] = 'multipart/form-data';
}
// Calculate form type
$type = trim(str_replace('open', null, $typeAsked), '_');
if (!in_array($type, $this->availableTypes)) {
$type = Config::get('default_form_type');
}
}
// Add the final form type
$attributes = Helpers::addClass($attributes, 'form-' . $type);
// Store it
$this->type = $type;
// Fetch errors if asked for
if (Config::get('fetch_errors')) {
Former::withErrors();
}
// Open the form
$this->action = $action;
$this->method = $method;
$this->attributes = $attributes;
$this->secure = $secure;
return $this;
}
示例3: show
/**
* Return html.
*
* @return string
*/
public function show()
{
return self::view('indicator', ['tag' => $this->tag, 'attributes' => Helpers::addClass($this->attributes, $this->class . ' ' . $this->type), 'message' => $this->message]);
}
示例4: addClass
/**
* Add a class to the current field
*
* @param string $class The class to add
*/
public function addClass($class)
{
$this->attributes = Helpers::addClass($this->attributes, $class);
}