/** * Constructs a RestfulDataProviderEFQ object. * * @param array $plugin * Plugin definition. * @param RestfulAuthenticationManager $auth_manager * (optional) Injected authentication manager. * @param DrupalCacheInterface $cache_controller * (optional) Injected cache backend. * @param string $language * (optional) The language to return items in. * * @throws RestfulServerConfigurationException */ public function __construct(array $plugin, \RestfulAuthenticationManager $auth_manager = NULL, \DrupalCacheInterface $cache_controller = NULL, $language = NULL) { parent::__construct($plugin, $auth_manager, $cache_controller, $language); $this->entityType = $plugin['entity_type']; $this->bundle = $plugin['bundle']; // Allow providing an alternative to \EntityFieldQuery. $data_provider_options = $this->getPluginKey('data_provider_options'); if (!empty($data_provider_options['efq_class'])) { if (!is_subclass_of($data_provider_options['efq_class'], '\EntityFieldQuery')) { throw new \RestfulServerConfigurationException(format_string('The provided class @class does not extend from \EntityFieldQuery.', array( '@class' => $data_provider_options['efq_class'], ))); } $this->EFQClass = $data_provider_options['efq_class']; } }
/** * Constructs a RestfulDataProviderCToolsPlugins object. * * @param array $plugin * Plugin definition. * @param RestfulAuthenticationManager $auth_manager * (optional) Injected authentication manager. * @param DrupalCacheInterface $cache_controller * (optional) Injected cache backend. * @param string $language * (optional) The language to return items in. */ public function __construct(array $plugin, \RestfulAuthenticationManager $auth_manager = NULL, \DrupalCacheInterface $cache_controller = NULL, $language = NULL) { parent::__construct($plugin, $auth_manager, $cache_controller, $language); // Validate keys exist in the plugin's "data provider options". $required_keys = array( 'module', 'type', ); $options = $this->processDataProviderOptions($required_keys); $this->module = $options['module']; $this->type = $options['type']; ctools_include('plugins'); }
/** * Constructs a RestfulDataProviderDbQuery object. * * @param array $plugin * Plugin definition. * @param RestfulAuthenticationManager $auth_manager * (optional) Injected authentication manager. * @param DrupalCacheInterface $cache_controller * (optional) Injected cache backend. * @param string $language * (optional) The language to return items in. */ public function __construct(array $plugin, \RestfulAuthenticationManager $auth_manager = NULL, \DrupalCacheInterface $cache_controller = NULL, $language = NULL) { parent::__construct($plugin, $auth_manager, $cache_controller, $language); // Validate keys exist in the plugin's "data provider options". $required_keys = array( 'table_name', 'id_column', ); $options = $this->processDataProviderOptions($required_keys); $this->tableName = $options['table_name']; $this->idColumn = $options['id_column']; $this->primary = empty($plugin['data_provider_options']['primary']) ? NULL : $this->primary = $plugin['data_provider_options']['primary']; }