Php 将自定义字段添加到任务列表中并显示到仪表板中的任何人(Phabricator)
我已将到期日添加到清单自定义字段中。现在我想让用户看到where-ever任务列表,然后在那里显示到期日期。 我知道它在代码库中的变化很小,但我无法调试它Php 将自定义字段添加到任务列表中并显示到仪表板中的任何人(Phabricator),php,project-management,phabricator,Php,Project Management,Phabricator,我已将到期日添加到清单自定义字段中。现在我想让用户看到where-ever任务列表,然后在那里显示到期日期。 我知道它在代码库中的变化很小,但我无法调试它 好的不是解决方案,而是一个开始 要更改此设置,您需要编辑 中的ManiphestTaskListView.php phabricator/src/applications/maniphest/view 您希望将到期日放在“已分配:”的位置 拉入自定义字段可能需要更多的研究,我认为您可以通过以下方式访问任务自定义字段 $fields = Ph
好的不是解决方案,而是一个开始 要更改此设置,您需要编辑 中的ManiphestTaskListView.php phabricator/src/applications/maniphest/view 您希望将到期日放在“已分配:”的位置 拉入自定义字段可能需要更多的研究,我认为您可以通过以下方式访问任务自定义字段
$fields = PhabricatorCustomField::getObjectFields(
$task,PhabricatorCustomField::ROLE_VIEW);
如果必须的话,你可以像这样取出你想要的字段,我想有更好的方法…所以你只需要特定的字段
if ($fields){
foreach ($fields->getFields() as $field){
if ($field->getModernFieldKey()=='custom.mycustomfield'){
// in theory you might be able to add it like this
$item->addByline(pht('%s', $field->getXXXX()));
}
}
我不确定您需要做什么来获取自定义字段值,我使用getXXXX()来表示您可能需要做的事情,我认为自定义字段通常有一个render()方法,但我也不完全确定如何在listview中渲染该值。好的,这不是一个解决方案,而是一个开始 要更改此设置,您需要编辑 中的ManiphestTaskListView.php phabricator/src/applications/maniphest/view 您希望将到期日放在“已分配:”的位置 拉入自定义字段可能需要更多的研究,我认为您可以通过以下方式访问任务自定义字段
$fields = PhabricatorCustomField::getObjectFields(
$task,PhabricatorCustomField::ROLE_VIEW);
如果必须的话,你可以像这样取出你想要的字段,我想有更好的方法…所以你只需要特定的字段
if ($fields){
foreach ($fields->getFields() as $field){
if ($field->getModernFieldKey()=='custom.mycustomfield'){
// in theory you might be able to add it like this
$item->addByline(pht('%s', $field->getXXXX()));
}
}
我不确定您需要做什么来获取自定义字段值,我使用getXXXX()来表示您可能需要做的事情,我认为自定义字段通常有一个render()方法,但我也不完全确定如何在listview中呈现它我错过了一个步骤,我想调用
$fields->readfields fromstoage($task)
,然后我使用了$field->getValueForStorage()
我不能说它有多正确,有多合法,甚至有多有效,但它确实做到了我认为你想要的
$fields = PhabricatorCustomField::getObjectFields(
$task,PhabricatorCustomField::ROLE_VIEW);
if ($fields){
$fields->readFieldsFromStorage($task);
foreach ($fields->getFields() as $field){
if ($field->getModernFieldKey()=='custom.mycustomfield'){
// in theory you might be able to add it like this
$item->addByline(pht('Due Date:%s', $field->getValueForStorage()));
$item->addByline(pht('Assigned: %s', $owner->renderLink()));
}
}
希望这有帮助我错过了你需要的一步我想调用
$fields->readfields fromstoage($task)
,然后我使用了$field->getValueForStorage()
我不能说它有多正确,有多合法,甚至有多有效,但它确实做到了我认为你想要的
$fields = PhabricatorCustomField::getObjectFields(
$task,PhabricatorCustomField::ROLE_VIEW);
if ($fields){
$fields->readFieldsFromStorage($task);
foreach ($fields->getFields() as $field){
if ($field->getModernFieldKey()=='custom.mycustomfield'){
// in theory you might be able to add it like this
$item->addByline(pht('Due Date:%s', $field->getValueForStorage()));
$item->addByline(pht('Assigned: %s', $owner->renderLink()));
}
}
希望这有帮助但我无法获取此字段的值{“mytask.due date”:{“name”:“due date”,“type”:“date”,“required”:“true”,“caption”:“this Task的due date”}您能帮助我吗。在现场列表之前工作正常吗?不知何故,我无法打印该字段的值。但我无法获取该字段的值{“mytask.due date”:{“name”:“due date”,“type”:“date”,“required”:“true”,“caption”:“this Task的due date”}您能帮助我吗。在现场列表之前工作正常吗?不知何故,我无法打印字段的值。向您致敬,兄弟:)它将帮助使用Phabricator的人数。伙计们,很好用。唯一需要格式化的是mysql中的INT字段。您需要将其转换为可用的格式。像这样的$item->addByline(pht('Due Date:%s',Date('d-M-Y H:i:s',$field->getValueForStorage());向你致敬,兄弟:)这将帮助很多使用Phabricator的人。伙计们,很好用。唯一需要格式化的是mysql中的INT字段。您需要将其转换为可用的格式。像这样的$item->addByline(pht('Due Date:%s',Date('d-M-Y H:i:s',$field->getValueForStorage());