/** * Get all fields from form * * @param \In2code\Powermail\Domain\Model\Form $form * @param string $property * @param bool $htmlSpecialChars * @return array */ public function render(\In2code\Powermail\Domain\Model\Form $form, $property = 'title', $htmlSpecialChars = TRUE) { $fields = array(); foreach ($form->getPages() as $page) { foreach ($page->getFields() as $field) { $fieldProperty = $field->{'get' . ucfirst($property)}(); if ($htmlSpecialChars) { $fieldProperty = htmlspecialchars($fieldProperty); } $fields[] = $fieldProperty; } } return $fields; }
/** * Get all fields from form * * @param Form $form * @param string $property * @param bool $htmlSpecialChars * @return array */ public function render(Form $form, $property = 'title', $htmlSpecialChars = true) { $fields = []; foreach ($form->getPages() as $page) { foreach ($page->getFields() as $field) { $fieldProperty = ObjectAccess::getProperty($field, $property); if ($htmlSpecialChars) { $fieldProperty = htmlspecialchars($fieldProperty); } $fields[] = $fieldProperty; } } return $fields; }
/** * Check if this form has an upload field * * @param Form $form * @return bool */ public static function hasFormAnUploadField(Form $form) { foreach ($form->getPages() as $page) { /** @var Field $field */ foreach ($page->getFields() as $field) { if ($field->getType() === 'file') { return true; } } } return false; }
/** * Check if this form has an upload field * * @param \In2code\Powermail\Domain\Model\Form $form * @return bool */ public static function hasFormAnUploadField(\In2code\Powermail\Domain\Model\Form $form) { foreach ($form->getPages() as $page) { foreach ($page->getFields() as $field) { if ($field->getType() === 'file') { return TRUE; } } } return FALSE; }