User tests: Successful: Unsuccessful:
Pull Request for Issue #16177.
List custom field rawvalue should always return an array.
Added a check and convert string to array if needed.
RawValue should always return as an array for list, so var_dump() on jcfields ie with:
echo '<pre>';
var_dump($this->item->jcfields);
die;
the list type should always be an array with 1 value or two.
RawValue should always return as an array for list
RawValue is a string if only 1 value is selected.
Status | New | ⇒ | Pending |
Category | ⇒ | Administration com_fields |
Title |
|
Labels |
Added:
?
|
Category | Administration com_fields | ⇒ | Administration com_fields Front End Plugins |
Nice one.
Now a custom text field's rawvalue is converted to an array. I added a var_dump to the function and access the frontend to check the rawvalue.
@Quy see my comment here #19978 (comment)
Drone said spaces weren’t allowed! Arghh.
On 3 Apr 2018, 03:21 +0100, Quy notifications@github.com, wrote:
@Quy commented on this pull request.
In plugins/fields/list/list.php:
- @param string $context The context.
* @param stdclass $item The item.
* @param stdclass $field The field.
*
* @return object
*
* @since __DEPLOY_VERSION__
*/
public function onCustomFieldsPrepareField($context, $item, $field)
{
// Check if the field should be processed
if (!$this->isTypeSupported($field->type))
{
return;
}
Remove tab.
—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub, or mute the thread.
@laoneo @Quy @carcam @GeraintEdwards
can we get some tests? Would be nice to clear this off.
Tested with staging when editing an article on the backend.
Call to undefined method FieldsHelper::displayFieldOnForm()
\joomla-cms-staging\administrator\components\com_fields\libraries\fieldsplugin.php:156
Call stack
--
# | Function | Location
1 | () | JROOT\administrator\components\com_fields\libraries\fieldsplugin.php:156
2 | FieldsPlugin->onCustomFieldsPrepareDom() | JROOT\administrator\components\com_fields\libraries\fieldslistplugin.php:33
3 | FieldsListPlugin->onCustomFieldsPrepareDom() | JROOT\libraries\joomla\event\event.php:70
4 | JEvent->update() | JROOT\libraries\joomla\event\dispatcher.php:160
5 | JEventDispatcher->trigger() | JROOT\libraries\src\Application\BaseApplication.php:108
6 | Joomla\CMS\Application\BaseApplication->triggerEvent() | JROOT\administrator\components\com_fields\helpers\fields.php:459
7 | FieldsHelper::prepareForm() | JROOT\plugins\system\fields\fields.php:288
8 | PlgSystemFields->onContentPrepareForm() | JROOT\libraries\joomla\event\event.php:70
9 | JEvent->update() | JROOT\libraries\joomla\event\dispatcher.php:160
10 | JEventDispatcher->trigger() | JROOT\libraries\src\MVC\Model\FormModel.php:321
11 | Joomla\CMS\MVC\Model\FormModel->preprocessForm() | JROOT\administrator\components\com_content\models\article.php:834
12 | ContentModelArticle->preprocessForm() | JROOT\libraries\src\MVC\Model\FormModel.php:242
13 | Joomla\CMS\MVC\Model\FormModel->loadForm() | JROOT\administrator\components\com_content\models\article.php:374
14 | ContentModelArticle->getForm() | JROOT\libraries\src\MVC\View\HtmlView.php:425
15 | Joomla\CMS\MVC\View\HtmlView->get() | JROOT\administrator\components\com_content\views\article\view.html.php:63
16 | ContentViewArticle->display() | JROOT\libraries\src\MVC\Controller\BaseController.php:672
17 | Joomla\CMS\MVC\Controller\BaseController->display() | JROOT\administrator\components\com_content\controller.php:54
18 | ContentController->display() | JROOT\libraries\src\MVC\Controller\BaseController.php:710
19 | Joomla\CMS\MVC\Controller\BaseController->execute() | JROOT\administrator\components\com_content\content.php:21
20 | require_once() | JROOT\libraries\src\Component\ComponentHelper.php:402
21 | Joomla\CMS\Component\ComponentHelper::executeComponent() | JROOT\libraries\src\Component\ComponentHelper.php:377
22 | Joomla\CMS\Component\ComponentHelper::renderComponent() | JROOT\libraries\src\Application\AdministratorApplication.php:101
23 | Joomla\CMS\Application\AdministratorApplication->dispatch() | JROOT\libraries\src\Application\AdministratorApplication.php:159
24 | Joomla\CMS\Application\AdministratorApplication->doExecute() | JROOT\libraries\src\Application\CMSApplication.php:196
25 | Joomla\CMS\Application\CMSApplication->execute() | JROOT\administrator\index.php:51
@Quy unfortunately your issue has nothing to do with my Pr. I've just tested it with latest staging 3.9.2-dev and all is fine. Furthermore, your error is to do with displayFieldOnForm() which isn't called by this plugin, this plugin only runs on onCustomFieldsPrepareField() which returns a string or an array. Always returning an array for lists is the same as if it has multiple values.
You're right. It must be with PatchTester. Applying manually results in no errors.
I have tested this item
I have tested this item
I have tested this item
Status | Pending | ⇒ | Ready to Commit |
RTC
Status | Ready to Commit | ⇒ | Fixed in Code Base |
Closed_Date | 0000-00-00 00:00:00 | ⇒ | 2018-12-27 18:57:00 |
Closed_By | ⇒ | mbabker | |
Labels |
Added:
?
|
I would prefer a solution where the field itself can set up the raw value. A possible way can be with a new plugin event. Hardcoding field types in the model should be avoided.