草庐IT

silverstripe-cropperfield

全部标签

php - 如何在 silverstripe 数据扩展中自动发布图像

我试图将上传字段添加到自定义DataExtension并使图像字段正常工作。但是,我上传的图像仍处于概念模式,我必须转到"file"选项卡才能发布它。我尝试使用Silverstripe文档中提供的代码,但这似乎只适用于常规页面。我发现了一个类似于我的问题:HowtoautomaticalypublishfilesuploadedtoadataobjectinSilverstripemodeladmin然而,这似乎只适用于DataObjects。这是我当前的代码:Image::class];privatestatic$owns=['Logo'];privatestatic$extensi

php - Silverstripe 清除/删除 TreeDropdownField

我正在为SiteTree下拉菜单使用TreeDropdownField,尽管这是一个可选字段并且希望能够清除/删除该值。我如何使用Silverstripe做到这一点?'Text','ExternalText'=>'Varchar','ImageLink'=>'Text');static$has_one=array("Image"=>"Image","InternalLink"=>"SiteTree");static$allowed_children=array("none");publicfunctiongetCMSFields(){$fields=parent::getCMSFiel

php - 使用 silverstripe 3.1 创建 pdf 的最佳方法?

我想在服务器端创建一个PDF文件。最好的方法是什么?有谁知道好的解决方案吗?提前致谢 最佳答案 还有silverstripe-tcpdf:https://github.com/mparkhill/silverstripe-tcpdf如果您在插件站点上搜索PDF,也可以找到此模块:-)http://addons.silverstripe.org/add-ons?search=pdf 关于php-使用silverstripe3.1创建pdf的最佳方法?,我们在StackOverflow上找到

php - 如何将调试消息写入 Silverstripe 日志文件

我有一个正在开发中的Silverstripe3.1站点,我想将消息写入默认日志文件-silverstripe.log这是我们用来向屏幕输出变量或消息的方式:Debug::show($variable);Debug::message("Debugmessagegoeshere");将这些输出到silverstripe.log文件的最简单方法是什么?我一直在查看文档,但找不到正确的方法:http://doc.silverstripe.com/framework/en/topics/debugging 最佳答案 您可以执行以下操作:在my

php - Silverstripe - 删除数据对象而不是使用自定义 sql 查询的更好方法

有没有更好的方法来删除早于x天的数据对象而不是使用自定义sql查询?这就是我现在做的$host='localhost';$username='db123';$password='pass';$db_name='db123';mysql_connect("$host","$username","$password")ordie("cannotconnect");mysql_select_db("$db_name")ordie("cannotselectDB");$sql="DELETEFROMCartWHERECreated 最佳答案

php - Silverstripe:ConfirmedPasswordField 不保存新密码

我试图让用户在前端更新他们的密码。除此字段外,所有其他字段都会更新。我正在使用Silverstripe版本3.4.0。这可能不是处理此问题的最佳方法://Edit&SaveyourdetailspublicfunctionEditMyDetails(){//IncludeJSforupdatingdetailsRequirements::javascript('module-memberprofiles/javascript/MemberProfileUpdate.js');Requirements::set_force_js_to_bottom(true);$fields=newFi

php - SilverStripe 按自定义顺序排序页面列表

有没有一种方法可以按自定义顺序(而不是按字母顺序)对创建页面菜单中的页面列表进行排序。我正在寻找类似于ModelAdmin菜单项排序方式的解决方案:privatestatic$menu_priority=2; 最佳答案 目前不是,因为它被硬编码为按“单数名称”排序,请参阅https://github.com/silverstripe/silverstripe-cms/blob/3.5/code/controllers/CMSMain.php#L493尽管如此,您可以子类化CMSMain类,覆盖方法PageTypes()并告诉Silv

php - SilverStripe $summary_field 中断标签翻译

我在我的DataObject中使用publicfunctionfieldLabels()来翻译所有字段标签(以及$summary_fields的标签)。这适用于所有字段,但具有从函数返回值(而不是从数据库中提取的值)的字段除外。摘要字段static$summary_fields=array('Label'=>'Label','Type'=>'Type','getRequiredLabel'=>'Required');字段标签publicfunctionfieldLabels($includerelations=true){$labels=parent::fieldLabels(true

php - 对继承对象重新排序/移动 Silverstripe 3 CMS 选项卡

到处搜索这个问题的答案,但似乎没有其他人拥有它或真正担心它。这是问题所在:A类有一个getCMSFields()方法,它添加了一个名为“Root.SEO”的选项卡,其中包含一些字段。B类继承自A类并拥有自己的getCMSFields()方法,该方法首先调用$fields=parent::getCMSFields()并向$fields添加更多字段/选项卡。SEO选项卡始终位于B类中设置的任何内容之前,因为A类首先执行。但我希望它位于B类定义的两个选项卡之间的某个位置我尝试了$fields->removeByName('SEO')并且他们手动重新添加了B类中的选项卡。这很好,但我似乎无法找

php - Silverstripe 条件验证

我有一个表单,其中包含多个操作,例如创建订单并创建报价单。根据单击的操作,我需要应用不同的验证。例如报价不需要订单编号。在Silverstripe中这可能吗?如果不是,我怎么会得到它?publicfunctionOrder($request=null){$form=Form::create($this,__FUNCTION__,FieldList::create(TextField::create('Name','YourFullName'),TextField::create('OrderRef','PurchaseOrder#')),FieldList::create(Litera