Skip to content

Commit

Permalink
fixed: possible notice in fileupload element when in multipage form, …
Browse files Browse the repository at this point in the history
…updated getEmailValue code to work with multi-uploaded ajax images
  • Loading branch information
pollen8 committed Oct 18, 2013
1 parent 41351df commit b5b0138
Showing 1 changed file with 27 additions and 4 deletions.
31 changes: 27 additions & 4 deletions plugins/fabrik_element/fileupload/fileupload.php
Expand Up @@ -898,6 +898,12 @@ public function validate($data = array(), $repeatCounter = 0)
$file = $files;
}

// Perhaps an ajax upload? In anay event $file empty was giving errors with upload element in multipage form.
if (!array_key_exists('name', $file))
{
return;
}

$fileName = $file['name'];
$fileSize = $file['size'];

Expand Down Expand Up @@ -2640,13 +2646,30 @@ public function getEmailValue($value, $data = array(), $repeatCounter = 0)

if ($params->get('fu_show_image_in_email', false))
{
$render = $this->loadElement($value);
$origShowImages = $params->get('fu_show_image');
$params->set('fu_show_image', true);

// For ajax repeats
$value = (array) $value;
$formModel = $this->getFormModel();

if (!isset($formModel->data))
{
$formModel->data = $data;
}

if (empty($value))
{
return '';
}

if ($params->get('fu_show_image') != '0')
foreach ($value as $v)
{
if ($value != '' && $storage->exists(COM_FABRIK_BASE . $value))
$render = $this->loadElement($v);

if ($v != '' && $storage->exists(COM_FABRIK_BASE . $v))
{
$render->render($this, $params, $value);
$render->render($this, $params, $v);
}
}

Expand Down

0 comments on commit b5b0138

Please sign in to comment.