GithubHelp home page GithubHelp logo

drupal-graphql / graphql-twig Goto Github PK

View Code? Open in Web Editor NEW
21.0 21.0 7.0 99 KB

Maintenance and issues moved over to Drupal.org!

Home Page: http://www.drupal.org/project/graphql_twig

PHP 94.22% HTML 2.54% CSS 1.65% JavaScript 1.58%

graphql-twig's People

Contributors

dan2k3k4 avatar fjgarlin avatar fubhy avatar hugovk avatar megadesk3000 avatar olli7 avatar pmelab avatar saschaeggi avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

graphql-twig's Issues

Compatible with Drupal 8.7.x ?

I was trying to test out this module following this webinar https://www.youtube.com/watch?v=QsmeXMZ0foM

I have setup graphql_twig and dependencies and graphiql using the explorer works as expected and returning the expected results

I have setup a simple bartik based graphql theme to follow the webinar above
and have created the exact same block--bartik-graphql-powered.html.twig template with the code mentioned in the webinar but also the drupal.org/project/graphql_twig page but nothing graphql is displayed

The graphql-twig-debug-button to Inspect GraphQL query is displayed and directs to the /graphql/explorer path and testing the query seems to produce the correct results.

I have tried putting the twig template in
themes/custom/bartik_graphql/components/block--bartik-graphql-powered.html.twig
themes/custom/bartik_graphql/templates/components/block--bartik-graphql-powered.html.twig
themes/custom/bartik_graphql/templates/block--bartik-graphql-powered.html.twig
and clearing cache before testing but it does not make any difference

I am using lando for a local setup with drupal 8.7.4 which otherwise seems to work OK
could it be related to my setup ? or could it be related to 8.7 ?
I have tried to investigate with a debugger but was hoping to narrow it down to where to look for before investing too much time on it.
Thanks for any help provided.

Missing required JS dependencies

The file at assets/debug.js implements jQuery, Drupal but these are not listed as dependencies in the graphql_twig.libraries.yml file, this causes console errors on themes without a base theme (which default to using the core stable theme), which causes travis CI tests to fail.

Theme base Routing

Running into an odd behavior with the routes defined in my theme info.yml file. I feel like I might be missing something simple, but the routes don't seem to be loading as I have them defined.

Here's what I have defined in my [THEME].info.yml file

routes:
  home:
    path: "/home"
    title: "MY TITLE HERE"

Here's what my templates/home.html.twig looks like:

<h1>HOME twig template</h1>
{% include '@storybook/01-base/02-atoms/title.twig' with { title: 'HOME THEME BASED ROUTING' } %}

This template never gets loaded when I browse to the home path.

Any ideas?

content localisation

How would you localise content from query?
I found that if I pass language as filter input to entities, the results are localised

works:nodeQuery(filter: {conditions: [{operator: EQUAL, field: "type", value: ["work"]}]}) {
      entities(language: IT) {
        ... on NodeWork {
          nid
          title
          services:fieldWorkServices {
            entity {
              nid
              title
            }
          }
          image:fieldWorkPreviewImage {
            url
          }
        }
      }
    }

But how do we pass the current language to the query?
Is there a better way for retrive localised content?
How do we pass calculated parameters to query, in general?

Missing subfolder in debug.js form action

When a site is installed in a subfolder the twig debug button does not work.

Instead of
https://example.com/subfolder/graphql/explorer
it opens
https://example.com/graphql/explorer.

[ERROR] You have requested a non-existent service "http_kernel.controller.argument_resolver".

Error during module install. I'm just exploring the module, so not yet clear what effect this has on its funcationality.

Drupal 8.5.6
GraphQL Twig 8.x-1.0-beta11

This is the only ref I can find to http_kernel.controller.argument_resolver:
graphql_twig/src/GraphqlTwigServiceProvider.php:25: $def = $container->getDefinition('http_kernel.controller.argument_resolver');

I'm guessing it may be related to the Symfony 3.1 change discussed in this core issue https://www.drupal.org/project/drupal/issues/2912169

Provide an option to not wrap the debug on the element itself

Currently the debug output can break stuff in some scenarios where we need to rely on the use of CSS features like :nth-of-type.
The solution would be to provide a module option to have the debug output inside of the element itself – like Drupals own Contextual links.

Add current route

Currently there is no easy way to use the blocksByRegion query without having to input the path to the route query, such as:

{#graphql
 query {
  menuByName("header") {
    id
  }
  route(path: "<front>") {
    ...on InternalUrl {
      blocksByRegion(region: "footer") {
        ...on BlockContentBasic {
          body {
            value
          }
        }
      }
    }
  }
 }
}

This could be streamlined if we have access to the currentRoute such as:

{#graphql
 query {
  menuByName("header") {
    id
  }
  currentRoute {
    blocksByRegion(region: "footer") {
      ...on BlockContentBasic {
        body {
          value
        }
      }
    }
  }
 }
}

Invalid argument supplied for foreach() in core ThemeHandler.php

greetings, after extensively tinkering with twig caching in order to remove the need for full cache clear after every change, I'm left with the following, any thoughts?

Warning: Invalid argument supplied for foreach() in Drupal\Core\Extension\ThemeHandler->addTheme() (line 202 of core/lib/Drupal/Core/Extension/ThemeHandler.php).
Drupal\Core\Extension\ThemeHandler->addTheme(Object) (Line: 191)
Drupal\Core\Extension\ThemeHandler->listInfo() (Line: 54)
Drupal\Core\Theme\ThemeAccessCheck->checkAccess('graphql') (Line: 69)
Drupal\Core\Theme\ThemeNegotiator->determineActiveTheme(Object) (Line: 405)
Drupal\Core\Theme\ThemeManager->initTheme(Object) (Line: 96)
Drupal\Core\Theme\ThemeManager->getActiveTheme() (Line: 43)
Drupal\Core\Cache\Context\ThemeCacheContext->getContext(NULL) (Line: 118)
Drupal\Core\Cache\Context\CacheContextsManager->convertTokensToKeys(Array) (Line: 307)
Drupal\Core\Render\RenderCache->createCacheID(Array) (Line: 66)
Drupal\Core\Render\RenderCache->get(Array) (Line: 109)
Drupal\Core\Render\PlaceholderingRenderCache->get(Array) (Line: 263)
Drupal\Core\Render\Renderer->doRender(Array, ) (Line: 195)
Drupal\Core\Render\Renderer->render(Array, ) (Line: 226)
Drupal\Core\Render\MainContent\HtmlRenderer->Drupal\Core\Render\MainContent\{closure}() (Line: 582)
Drupal\Core\Render\Renderer->executeInRenderContext(Object, Object) (Line: 227)
Drupal\Core\Render\MainContent\HtmlRenderer->prepare(Array, Object, Object) (Line: 117)
Drupal\Core\Render\MainContent\HtmlRenderer->renderResponse(Array, Object, Object) (Line: 90)
Drupal\Core\EventSubscriber\MainContentViewSubscriber->onViewRenderArray(Object, 'kernel.view', Object)
call_user_func(Array, Object, 'kernel.view', Object) (Line: 111)
Drupal\Component\EventDispatcher\ContainerAwareEventDispatcher->dispatch('kernel.view', Object) (Line: 156)
Symfony\Component\HttpKernel\HttpKernel->handleRaw(Object, 1) (Line: 68)
Symfony\Component\HttpKernel\HttpKernel->handle(Object, 1, 1) (Line: 57)
Drupal\Core\StackMiddleware\Session->handle(Object, 1, 1) (Line: 47)
Drupal\Core\StackMiddleware\KernelPreHandle->handle(Object, 1, 1) (Line: 99)
Drupal\page_cache\StackMiddleware\PageCache->pass(Object, 1, 1) (Line: 78)
Drupal\page_cache\StackMiddleware\PageCache->handle(Object, 1, 1) (Line: 47)
Drupal\Core\StackMiddleware\ReverseProxyMiddleware->handle(Object, 1, 1) (Line: 50)
Drupal\Core\StackMiddleware\NegotiationMiddleware->handle(Object, 1, 1) (Line: 23)
Stack\StackedHttpKernel->handle(Object, 1, 1) (Line: 664)
Drupal\Core\DrupalKernel->handle(Object) (Line: 19)

Dynamic query building

Thank you for providing this awesome module. We really appreciate it a lot. Currently i am stuck with the following problem: I am using graphql search api module to set up some pages with filtered content and facets. One question that came up is, if there is a way to generate/alter graphql queries to have e.g. a dynamic amount of conditions.

Lets say i have the following query:

  searchAPISearch(
    index_id: "keyword_index", 
    language: "de", 
    range: {start: 1, end: 50},
    conditions: [
      {operator: "=", name: "aggregated_terms", value: "34"}
    ] 
  )
  {
     // ...
  }

What i need is to have a dynamic conditions block, based on the amount of fields i want to filter for. So if i want to get results that match the ids 34, 35 and 36 i need to query this way:

    // ...
    conditions: [
      {operator: "=", name: "aggregated_terms", value: "34"}
      {operator: "=", name: "aggregated_terms", value: "35"}
      {operator: "=", name: "aggregated_terms", value: "36"}
    ] 
    // ...

Is there a way/workaround to achieve that? Thanks a lot for pointing me in the right direction.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.