module/Core/src/Grid/Core/Controller/UploadController.php
protected function getForm( $types, $pattern )
    {
        $types = preg_replace( '/\s+/', '', implode( ',', (array) $types ) );

        if ( '*/*' === $types )
        {
            $types = '*';
        }

        if ( empty( $types ) )
        {
            $label = 'mime.sets.*';
        }
        else if ( strstr( $types, '*' ) || strstr( $types, ',' )  )
        {
            $label = 'mime.sets.' . $types;
        }
        else
        {
            $label = 'mime.type.' . $types;
        }

        $accept = '*' == $types ? '*/*' : $types;

        return $this->getServiceLocator()
                    ->get( 'Zork\Form\Factory' )
                    ->createForm( array(
                        'attributes'    => array(
                            'action'    => '?',
                            'method'    => 'post',
                        ),
                        'elements'      => array(
                            'types'     => array(
                                'spec'  => array(
                                    'type'  => 'Zork\Form\Element\Hidden',
                                    'name'  => 'types',
                                    'attributes' => array(
                                        'value' => $accept,
                                    ),
                                ),
                            ),
                            'pattern'   => array(
                                'spec'  => array(
                                    'type'  => 'Zork\Form\Element\Hidden',
                                    'name'  => 'pattern',
                                    'attributes' => array(
                                        'value' => $pattern,
                                    ),
                                ),
                            ),
                            'file'      => array(
                                'spec'  => array(
                                    'type'      => 'Zork\Form\Element\File',
                                    'name'      => 'file',
                                    'options'   => array(
                                        'required'      => true,
                                        'label'         => $label,
                                        'accept'        => $accept,
                                        'validators'    => $this->getValidators( $types )
                                    ),
                                ),
                            ),
                            'upload'    => array(
                                'spec'  => array(
                                    'type'      => 'Zork\Form\Element\Submit',
                                    'name'      => 'upload',
                                    'attributes'    => array(
                                        'value'     => 'default.upload',
                                    ),
                                ),
                            ),
                        ),
                    ) );
    }
protected function getForm( $types, $pattern )
    {
        $types = preg_replace( '/\s+/', '', implode( ',', (array) $types ) );

        if ( '*/*' === $types )
        {
            $types = '*';
        }

        if ( empty( $types ) )
        {
            $label = 'mime.sets.*';
        }
        else if ( strstr( $types, '*' ) || strstr( $types, ',' )  )
        {
            $label = 'mime.sets.' . $types;
        }
        else
        {
            $label = 'mime.type.' . $types;
        }

        $accept = '*' == $types ? '*/*' : $types;

        return $this->getServiceLocator()
                    ->get( 'Zork\Form\Factory' )
                    ->createForm( array(
                        'attributes'    => array(
                            'action'    => '?',
                            'method'    => 'post',
                        ),
                        'elements'      => array(
                            'types'     => array(
                                'spec'  => array(
                                    'type'  => 'Zork\Form\Element\Hidden',
                                    'name'  => 'types',
                                    'attributes' => array(
                                        'value' => $accept,
                                    ),
                                ),
                            ),
                            'pattern'   => array(
                                'spec'  => array(
                                    'type'  => 'Zork\Form\Element\Hidden',
                                    'name'  => 'pattern',
                                    'attributes' => array(
                                        'value' => $pattern,
                                    ),
                                ),
                            ),
                            'file'      => array(
                                'spec'  => array(
                                    'type'      => 'Zork\Form\Element\File',
                                    'name'      => 'file',
                                    'options'   => array(
                                        'required'      => true,
                                        'label'         => $label,
                                        'accept'        => $accept,
                                        'validators'    => $this->getValidators( $types )
                                    ),
                                ),
                            ),
                            'upload'    => array(
                                'spec'  => array(
                                    'type'      => 'Zork\Form\Element\Submit',
                                    'name'      => 'upload',
                                    'attributes'    => array(
                                        'value'     => 'default.upload',
                                    ),
                                ),
                            ),
                        ),
                    ) );
    }
protected function getForm ( $ types , $ pattern ) { $ types = preg_replace ( '/\s+/' , '' , implode ( ',' , ( array ) $ types ) ) ; if ( '*/*' === $ types ) { $ types = '*' ; } if ( empty ( $ types ) ) { $ label = 'mime.sets.*' ; } else if ( strstr ( $ types , '*' ) || strstr ( $ types , ',' ) ) { $ label = 'mime.sets.' . $ types ; } else { $ label = 'mime.type.' . $ types ; } $ accept = '*' == $ types ? '*/*' : $ types ; return $ this -> getServiceLocator ( ) -> get ( 'Zork\Form\Factory' ) -> createForm ( array ( 'attributes' => array ( 'action' => '?' , 'method' => 'post' , ) , 'elements' => array ( 'types' => array ( 'spec' => array ( 'type' => 'Zork\Form\Element\Hidden' , 'name' => 'types' , 'attributes' => array ( 'value' => $ accept , ) , ) , ) , 'pattern' => array ( 'spec' => array ( 'type' => 'Zork\Form\Element\Hidden' , 'name' => 'pattern' , 'attributes' => array ( 'value' => $ pattern , ) , ) , ) , 'file' => array ( 'spec' => array ( 'type' => 'Zork\Form\Element\File' , 'name' => 'file' , 'options' => array ( 'required' => true , 'label' => $ label , 'accept' => $ accept , 'validators' => $ this -> getValidators ( $ types ) ) , ) , ) , 'upload' => array ( 'spec' => array ( 'type' => 'Zork\Form\Element\Submit' , 'name' => 'upload' , 'attributes' => array ( 'value' => 'default.upload' , ) , ) , ) , ) , ) ) ; }
Get the upload-form

@param string|array $types
@param string $pattern
@return \Zend\Form\Form
Get the upload - form