Giter VIP home page Giter VIP logo

custom_movies's Introduction

Custom Module for managing movies

What does this module do

  1. Creates a custom content entity name Movie with the fields title and release date
  2. Create a taxonomy vocabulary named Genre with the following terms: Comedy, Drama, and Action.
  3. Add a genre field to the movie entity that is a reference to the Genre vocabulary.
  4. Add validation to the movie entity’s add and edit forms so that the release_date field is required and that it cannot be in the future.
  5. Expose a REST export for all the Movie entities.

Usage

Installation

Manually

Download and install as any other drupal module.

Composer

  1. Add david4lim/custom_movies to your composer.json repositories:
    "repositories": [
        {
            "type": "composer",
            "url": "https://packages.drupal.org/8"
        },
        {
            "type": "package",
            "package": {
                "name": "david4lim/custom_movies",
                "version": "dev-master",
                "type":"drupal-custom-module",
                "source": {
                    "url": "https://github.com/david4lim/custom_movies",
                    "type": "git",
                    "reference": "master"
                }
            }
        }
    ]
  1. Add the composer package:
composer require david4lim/custom_movies:dev-master
  1. Install the module using drush:
drush en custom_movies

Managing movies

All the CRUD action can be found in /admin/content/movie.

Accessing movies REST export

The movies export is accessible from the path /movies?_format=json, only json format is enabled, so it can also be accessed using only/movies and json format will be used.

Notes

  1. The movie entity was generated using the drush command drush gen entity:content.
  2. The release date validation was done by creating a new field constraint plugin, and adding it to the release_date field definition.
  3. All javascript alterations were done in the library custom_movies/movies.admin_form.

custom_movies's People

Contributors

david4lim avatar

Watchers

 avatar

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.