Is a good practice to inject a service whenever is possible.
Reading the code on the Drupal
Class you can find the httpClient
method:
/**
<?php | |
namespace Drupal\acme\Controller; | |
use Drupal\Core\Controller\ControllerBase; | |
class DefaultController extends ControllerBase | |
{ | |
/** |
# From your Google Spreadsheet, select the menu item Tools > Script editor. | |
# Copy and paste this code. | |
# Replace uuid with the build_hooks uuid from your Netlify project. | |
function onOpen() { | |
SpreadsheetApp.getUi() | |
.createMenu('Scripts') | |
.addItem('Build', 'build') | |
.addToUi(); | |
} |
#!/bin/bash | |
## | |
# Script to crawl Drupal JSON:API endpoint to local filesystem. | |
# | |
# Assumes endpoint to be /jsonapi and uses basic auth. | |
# | |
# Requirements: | |
# ag - https://github.com/ggreer/the_silver_searcher | |
# jq - https://github.com/stedolan/jq |
exports.createResolvers = ({ actions, getCache, createNodeId, createResolvers }) => { | |
const { createNode } = actions | |
createResolvers({ | |
Drupal_MediaImage: { | |
gatsbyImageFile: { | |
type: `File`, | |
resolve(source) { | |
return createRemoteFileNode({ |
brew install fish |
<?php | |
/** | |
* @file | |
* Contains \Drupal\my_module\Plugin\rest\resource\MyRestResource. | |
*/ | |
namespace Drupal\my_module\Plugin\rest\resource; | |
use Drupal\Core\Session\AccountProxyInterface; |
const path = require("path"); | |
const { createRemoteFileNode } = require(`gatsby-source-filesystem`); | |
// GraphQL Schema customization to download and attach images to GraphQL node | |
exports.createResolvers = ( | |
{ | |
actions, | |
cache, | |
createNodeId, | |
createResolvers, |
No dates announced yet:
Event | Date |
---|---|
Gatsby Days LA | February 3 |
Startup Grind Global SF | February 11-12 |
<?php | |
namespace Drupal\jsonapi_custom\Controller; | |
use Drupal\Core\Controller\ControllerBase; | |
use Psr\Http\Message\ServerRequestInterface; | |
use Symfony\Component\DependencyInjection\ContainerInterface; | |
use Symfony\Component\HttpFoundation\JsonResponse; | |
use Drupal\jsonapi_extras\EntityToJsonApi; |