PHP code example of hoppinger / rest_normalizations
1. Go to this page and download the library: Download hoppinger/rest_normalizations library. Choose the download type require. 2. Extract the ZIP file and open the index.php. 3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
hoppinger / rest_normalizations example snippets
namespace Drupal\module_name;
use Drupal\Core\DependencyInjection\ContainerBuilder;
use Drupal\Core\DependencyInjection\ServiceProviderBase;
use Symfony\Component\DependencyInjection\Reference;
class ModuleNameServiceProvider extends ServiceProviderBase {
public function alter(ContainerBuilder $container) {
if ($container->hasParameter('rest_normalizations.target_identifiers')) {
$target_identifiers = $container->getParameter('rest_normalizations.target_identifiers');
$target_identifiers[] = <target_identifier>; #e.g., node-story_overview-field_featured_story
$container->setParameter('rest_normalizations.target_identifiers', $target_identifiers);
}
}