Giter Site home page Giter Site logo

d8-site-api-key's Introduction

Background Information

When logged in as the administrator, the "Site Information" form can be found at the path /admin/config/system/site-information.

Requirements

This module needs to alter the existing Drupal "Site Information" form. Specifics:

  • A new form text field named "Site API Key" needs to be added to the "Site Information" form with the default value of “No API Key yet”.
  • When this form is submitted, the value that the user entered for this field should be saved as the system variable named "siteapikey".
  • A Drupal message should inform the user that the Site API Key has been saved with that value.
  • When this form is visited after the "Site API Key" is saved, the field should be populated with the correct value.
  • The text of the "Save configuration" button should change to "Update Configuration".
  • This module also provides a URL that responds with a JSON representation of a given node with the content type "page" only if the previously submitted API Key and a node id (nid) of an appropriate node are present, otherwise it will respond with "access denied".

Example URL

http://localhost/page_json/FOOBAR12345/17

Resources

Time Taken

The approximate time taken to implement this module was 5 hours. Note: It was my first time to build a Drupal 8 module.

d8-site-api-key's People

Contributors

tsega avatar

Stargazers

 avatar

Watchers

 avatar  avatar  avatar  avatar

d8-site-api-key's Issues

Change button label

The text of the "Save configuration" button should change to "Update Configuration".

Node JSON Representation

This module also provides a URL that responds with a JSON representation of a given node with the content type "page" only if the previously submitted API Key and a node id (nid) of an appropriate node are present, otherwise it will respond with "access denied".

Example:

http://localhost/page_json/FOOBAR12345/17

Save new field into database

When this form is submitted, the value that the user entered for this field should be saved as the system variable named "siteapikey".

Show value on re-visit

When this form is visited after the "Site API Key" is saved, the field should be populated with the correct value.

New Field in Site Information

A new form text field named "Site API Key" needs to be added to the "Site Information" form with the default value of “No API Key yet”.

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.