Giter Club home page Giter Club logo

media_entity_instagram's Introduction

About Media entity

Media entity provides a 'base' entity for a media element. This is a very basic entity which can reference to all kinds of media-objects (local files, YouTube videos, tweets, CDN-files, ...). This entity only provides a relation between Drupal (because it is an entity) and the resource. You can reference to this entity within any other Drupal entity.

About Media entity Instagram

This module provides Instagram integration for Media entity (i.e. media type provider plugin).

Without Instagram API

If you need just to embembed instagrams you can use this module without using Instagram's API. That will give you access to the shortcode field available from the url/embed code.

You will need to:

  • Create a Media bundle with the type provider "Instagram".
  • On that bundle create a field for the Instagram url/source (this should be a plain text or link field).
  • Return to the bundle configuration and set "Field with source information" to use that field.

IMPORTANT: beware that there is limit on the number of request that can be made for free. Read more

With Instagram API

If you need to get other fields, you will need to use Instagram's API. To get this working follow the steps below:

  • Download and enable composer_manager. Also make sure you have drush installed.
  • Run the following commands from within your Drupal root directory to download the library that will handle the communication:
  // Rebuild the composer.json file with updated dependencies.
  $ drush composer-json-rebuild

  // Install the required packages.
  $ drush composer-manager install
  • Create a instagram app on the instagram developer site
  • Enable read access for your instagram app
  • Grab your client ID from the instagram developer site
  • In your Instagram bundle configuration set "Whether to use Instagram api to fetch instagrams or not" to "Yes"" and paste in the "Client ID"

NOTE: We are currently using a patched version of the library with the ability to get the media by shortcode. This is the pull request for it: https://github.com/galen/PHP-Instagram-API/pull/46/files

Storing field values

If you want to store the fields that are retrieved from Instagram you should create appropriate fields on the created media bundle (id) and map this to the fields provided by Instagram.php.

NOTE: At the moment there is no GUI for that, so the only method of doing that for now is via CMI.

This would be an example of that (the field_map section):

langcode: en
status: true
dependencies:
  module:
    - media_entity_instagram
id: instagram
label: Instagram
description: 'Instagram photo/video to be used with content.'
type: instagram
type_configuration:
  source_field: link
  use_instagram_api: '1'
  client_id: YOUR_CLIENT_ID
field_map:
  id: instagram_id
  type: instagram_type
  thumbnail: instagram_thumbnail
  username: instagram_username
  caption: instagram_caption
  tags: instagram_tags

Project page: http://drupal.org/project/media_entity_instagram

Maintainers:

IRC channel: #drupal-media

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.