Upload::__construct( string $form_name, string $name, array $args )
Description #
Initialize the class.
Parameters #
- $form_namestring (Required) Name of parent form.
- $namestring (Required) Name of field.
- $argsarray (Required) Field arguments.
Source #
File: lib/form/class-upload.php
public function __construct( $form_name, $name, $args ) { parent::__construct( $form_name, $name, $args ); // Do not add array in field name. $this->field_name = $this->id(); $this->multiple_upload = $this->args['upload_options']['multiple']; // Add array to field name if multiple file allowed. if ( true === $this->multiple_upload ) { $this->field_name = $this->field_name . '[]'; } // Make sure field is sanitized. $this->sanitize_cb = array_merge( array( 'upload' ), $this->sanitize_cb ); $this->validate_cb = array_merge( array( 'upload' ), $this->validate_cb ); }
Expand full source code Collapse full source code View on GitHub: lib/form/class-upload.php:69
Add your comment