From cd728cc876bf3786f599a9b3f2a83826a93e405e Mon Sep 17 00:00:00 2001 From: ADmad Date: Fri, 13 Sep 2024 21:19:02 +0530 Subject: [PATCH] Swap arguments of CrudViewHelper::fieldValue() for consistency --- src/View/Helper/CrudViewHelper.php | 4 ++-- templates/element/index/gallery.php | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/View/Helper/CrudViewHelper.php b/src/View/Helper/CrudViewHelper.php index 343f1c0..1382acb 100644 --- a/src/View/Helper/CrudViewHelper.php +++ b/src/View/Helper/CrudViewHelper.php @@ -123,11 +123,11 @@ public function process(string $field, EntityInterface $data, array $options = [ /** * Get the current field value * - * @param \Cake\Datasource\EntityInterface|null $data The entity data. * @param string $field The field to extract, if null, the field from the entity context is used. + * @param \Cake\Datasource\EntityInterface|null $data The entity data. * @return mixed */ - public function fieldValue(?EntityInterface $data, string $field): mixed + public function fieldValue(string $field, ?EntityInterface $data = null): mixed { if ($data === null) { return $this->getContext()->val($field, ['schemaDefault' => false]); diff --git a/templates/element/index/gallery.php b/templates/element/index/gallery.php index e86bf68..5577fc3 100644 --- a/templates/element/index/gallery.php +++ b/templates/element/index/gallery.php @@ -18,7 +18,7 @@
CrudView->fieldValue($singularVar, $indexTitleField); + $imageAltContent = $this->CrudView->fieldValue($indexTitleField, $singularVar); $titleContent = $this->CrudView->process($indexTitleField, $singularVar, $titleOptions); $bodyContent = $this->CrudView->process($indexBodyField, $singularVar, $bodyOptions); $imageContent = $this->CrudView->process($indexImageField, $singularVar, $imageOptions);