ivoba / silverstripe-profileable
SilverStripe Profileable 模块
1.1.0
2016-07-01 08:24 UTC
Requires
This package is auto-updated.
Last update: 2024-09-10 21:25:54 UTC
README
Profileable 模块通过扩展 addressable 模块,将典型的个人资料字段(如地址、电子邮件、个人资料图片等)添加到对象中。它继承了 addressable 模块的所有功能,例如自动地理编码。
需求
- SilverStripe 3+
- Addressable: https://github.com/ajshort/silverstripe-addressable
快速使用概述
首先安装 Addressable 模块!为了将个人资料+地址字段(名称、地址、郊区、城市、邮编和国家、城市、电话、传真、电子邮件、网址、图片)添加到对象中,只需应用 Profileable
扩展。
Object::add_extension('Object', 'Profileable');
运行 dev/build,你将在后端为扩展对象获得一个“个人资料”标签页。
要在模板中渲染个人资料,请调用此函数:$getFullProfileHTML。这将使用语义 hContact mircroformat 标记渲染个人资料。
要配置个人资料图片上传,请在 _config.php 中设置此选项。
Profileable::$ProfilePictureAllowedTypes = array('png');
Profileable::$ProfilePictureFolder = 'youruploaddir';
您可以使用 addressable 模块的所有功能,例如:自动地理编码
Object::add_extension('Object', 'Geocodable');
或在 _config.yml 中
MyPage:
extensions:
- Profileable
- Geocodable
定义一组全局允许的状态或国家
Profileable::set_allowed_countries(array('DE'=>'Deutschland'));
渲染 GoogleMap
$ProfileMap(300,200)
在 MIT 许可证下发布(即,您可以随意使用此代码,并自行承担风险)