You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

56 lines
1.0 KiB
PHP

This file contains ambiguous Unicode characters!

This file contains ambiguous Unicode characters that may be confused with others in your current locale. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to highlight these characters.

<?php
namespace Artmark\Forms\Attributes;
/**
* Description of MultipartAttribute
*
* @author Andrey Pokidov <pokidov@e-traffic.ru>
*/
trait MultipartAttribute
{
/**
*
* @var boolean
*/
private $multipart = false;
/**
* Есть ли в форме файлы
* @return boolean
*/
public function isMultipart()
{
return $this->multipart;
}
/**
* Помечает форму как форму с файлами
* @return $this
*/
public function setMultipart()
{
$this->multipart = true;
return $this;
}
/**
* Помечает форму как форму без файлов
* @return $this
*/
public function setSinglePart()
{
$this->multipart = false;
return $this;
}
protected function appendMultipartAttribute(array & $attributes)
{
if ($this->multipart) {
$attributes['enctype'] = 'multipart/form-data';
}
}
}