You are here

public function RestfulFilesUpload::__construct in RESTful 7

Overrides \RestfulEntityBase::__construct()

Set the "options" key from the plugin info, specific for file upload, with the following keys:

  • "validators": By default no validation is done on the file extensions or file size.
  • "scheme": By default the default scheme (e.g. public, private) is used.

Overrides RestfulDataProviderEFQ::__construct

File

plugins/restful/RestfulFilesUpload.php, line 30
Contains RestfulFilesUpload.

Class

RestfulFilesUpload
@file Contains RestfulFilesUpload.

Code

public function __construct(array $plugin, \RestfulAuthenticationManager $auth_manager = NULL, \DrupalCacheInterface $cache_controller = NULL, $language = NULL) {
  parent::__construct($plugin, $auth_manager, $cache_controller, $language);
  if (!($options = $this
    ->getPluginKey('options'))) {
    $options = array();
  }
  $default_values = array(
    'validators' => array(
      'file_validate_extensions' => array(),
      'file_validate_size' => array(),
    ),
    'scheme' => file_default_scheme(),
    'replace' => FILE_EXISTS_RENAME,
  );
  $this
    ->setPluginKey('options', drupal_array_merge_deep($default_values, $options));
}