疗养院 / inputs
扩展输入类型
Requires
- php: >=5.4.0
- cartalyst/composer-installers: >=1.2.0
- platform/foundation: >=2.0 <5.0
- dev-master
- 4.3.26
- 4.3.25
- 4.3.24
- 4.3.23
- 4.3.22
- 4.3.21
- 4.3.20
- 4.3.19
- 4.3.18
- 4.3.17
- 4.3.16
- 4.3.15
- 4.3.14
- 4.3.13
- 4.3.12
- 4.3.11
- 4.3.10
- 4.3.9
- 4.3.8
- 4.3.7
- 4.3.6
- 4.3.5
- 4.3.4
- 4.3.3
- 4.3.2
- 4.3.1
- 4.3.0
- 4.2.3
- 4.2.2
- 4.2.1
- 4.2.0
- 4.1.9
- 4.1.8
- 4.1.7
- 4.1.6
- 4.1.5
- 4.1.4
- 4.1.3
- 4.1.2
- 4.1.1
- 4.1.0
- 4.0.5
- 4.0.4
- 4.0.3
- 4.0.2
- 4.0.1
- 4.0.0
- 3.3.1
- 3.3.0
- 3.2.1
- 3.2.0
- 3.1.0
- 3.0.5
- 3.0.4
- 3.0.3
- 3.0.2
- 3.0
- 2.1.4
- 2.1.3
- 2.1.2
- 2.1.1
- 2.1.0
- 2.0.9
- 2.0.8
- 2.0.7
- 2.0.6
- 2.0.5
- 2.0.4
- 2.0.3
- 2.0.2
- 2.0.1
- 2.0.0
- 1.2.6
- 1.2.5
- 1.2.4
- 1.2.3
- 1.2.2
- 1.2.1
- 1.2.0
- 1.1.5
- 1.1.4
- 1.1.3
- 1.1.2
- 1.1.1
- 1.1.0
- 1.0.9
- 1.0.8
- 1.0.7
- 1.0.6
- 1.0.5
- 1.0.4
- 1.0.3
- 1.0.2
- 1.0.1
- 1.0.0
- 0.1.9
- 0.1.8
- 0.1.7
- 0.1.6
- 0.1.5
- 0.1.4
- 0.1.3
- 0.1.2
This package is not auto-updated.
Last update: 2024-09-14 19:31:23 UTC
README
扩展输入类型
文档
可用输入类型
分类
从树中选择分类(即将弃用 >>> 请参阅关系)。
国家
从列表中选择国家。
日期
日期格式化输入。
电子邮件
电子邮件格式化输入。
文件
从媒体库中选择单个文件。 子类型到媒体
相册
从媒体库中选择多个图片。 子类型到媒体
图片
从媒体库中选择单个图片。 子类型到媒体
媒体
从媒体库中选择多个文件,也是文件、相册、图片、视频的父类型。
电话
电话格式化输入。
关系
与其他实体的关系。
要注册新扩展,请使用
try
{
// Register new relation
$this->app['sanatorium.inputs.relations']->registerRelation(
'qualification', 'Sleighdogs\Qualifications\Models\Qualification'
);
//
} catch (\ReflectionException $e)
{
// sanatorium/inputs is not installed or does not support relations
}
注意:上面的代码必须启动 sanatorium/inputs 后才能正常工作,因此请记住将任何使用此代码注册的扩展作为 sanatorium/inputs 的依赖项(请参阅扩展.php 中的 require 块)。
重复器
多个输入值
刻度
1-100(将扩展)滑动刻度输入。
开关器
一个或多个(允许选项)复选框具有“开关器外观”。
标签
多选,允许有权限的用户添加新值。
真/假
单个真/假值。
网址
网址链接输入。
视频
从媒体库中选择单个视频。 子类型到媒体
所见即所得
所见即所得编辑器输入字段。
创建自定义类型
-
在 Sanatorium\Inputs\Types 命名空间中创建新类,可能如下所示
<?php namespace Sanatorium\Inputs\Types; class ScaleType extends BaseType { public $settings = [ 'min' => [ 'name' => 'sanatorium/inputs::types.settings.min', 'default' => 0, 'validation'=> 'numeric|max:max', 'type' => 'number' ], 'max' => [ 'name' => 'sanatorium/inputs::types.settings.max', 'default' => 100, 'validation'=> 'numeric|min:min', 'type' => 'number', ] ]; /** * {@inheritDoc} */ protected $identifier = 'scale'; }
-
在 Sanatorium\Inputs\Providers\InputServiceProvider::registerTypes() 方法中注册该类
$types = [ ... 'date' => new Types\ScaleType, ];
-
创建模板以在前后端显示自定义类型,在 sanatorium/inputs::types/{typeidentifider} 主题路径中。例如:/themes/admin/default/packages/sanatorium/input/views/types/scale.blade.php 和 /themes/frontend/default/packages/sanatorium/input/views/types/scale.blade.php
小部件
@display
显示媒体输入类型的小部件
{{-- Show single image --}}
@display($product, 'cover_image', 'single')
{{-- Show gallery images --}}
@display($product, 'gallery', 'multiple')
@displaygroup
显示输入组值的组件
{{-- Show input group table --}}
@displaygroup($product, 'Technical information')
函数
以下所有函数都不是命名空间化的,您可以在 src/helpers.php 中找到它们的代码
媒体相关
storage_url($media); // Link to media on any storage
thumbnail_url($media, $width = 300, $height = 300) // Link to thumbnail
mime2Extension($mime, $extension = '') // Returns most common extension to mime type
选择、复选框、多选函数
get_attribute_label
get_attribute_label($key, $slug) // Return label of single selected value
get_attribute_labels
get_attribute_labels($keys = [], $slug, $return = 'string', $implode = ', ') // Return labels of selected values
返回例如
get_attribute_labels($product->animal, 'animal', 'array') // => array ('cow' => 'Cow')
显示值相关
str_scheme($url, $scheme = 'http://'); // Add protocol if missing
str_links($text); // Turn URLs in content to <a href>
主题相关
theme_set($theme); // Set active theme
theme_set_fallback($theme); // Set fallback theme
theme_set_area($area); // Set area of theme (admin|frontend)
theme_frontend(); // Shorthand for theme_set_area('frontend');
theme_admin(); // Shorthand for theme_set_area('admin');
变更日志
- 4.3.0 - 2016-09-25 - 重复器现在允许子字段定义
- 4.1.6 - 2016-09-21 - 输入组上的“必需”设置
- 4.1.0 - 2016-09-18 - 主题相关函数,添加了 @display 主题部分
- 4.0.0 - 2016-09-15 - 标签字段
- 3.0.0 - 2016-08-31 - 支持 Platform v5.0
- 1.2.0 - 2016-08-06 - 添加关系、网址、电话、电子邮件、支持分组
- 0.1.8 - 2016-05-16 - 基本说明文件
支持
不支持。