function restful_get_formatter_handler in RESTful 7
Return the formatter handler based on the formatter plugin name.
Parameters
string $formatter_plugin_name: Name of the formatter plugin.
\RestfulBase $restful_handler: The resource handler.
Return value
\RestfulFormatterInterface The formatter provider object.
Throws
\RestfulException if the formatter provider does not exist.
4 calls to restful_get_formatter_handler()
- RestfulBase::options in plugins/
restful/ RestfulBase.php - Call resource using the OPTIONS http method.
- RestfulDiscoveryTestCase::testOptionsMethod in tests/
RestfulDiscoveryTestCase.test - Test the headers populated in an OPTIONS request.
- RestfulListTestCase::testFilter in tests/
RestfulListTestCase.test - Test filtering.
- RestfulManager::outputFormat in includes/
RestfulManager.php - Helper function to get the default output format from the current request.
File
- ./
restful.module, line 357
Code
function restful_get_formatter_handler($formatter_plugin_name, $restful_handler) {
$formatter_plugin = restful_get_formatter_plugin($formatter_plugin_name);
if (!($formatter_class = ctools_plugin_get_class($formatter_plugin, 'class'))) {
throw new \RestfulServiceUnavailable(format_string('Formatter plugin class (@plugin) was not found.', array(
'@plugin' => $formatter_plugin_name,
)));
}
return new $formatter_class($formatter_plugin, $restful_handler);
}