2017 © Pedro Peláez
 

ezplatform-bundle cloudinary-metaindexer

Indexes cloudinary account to a mongodb database, and makes it available to list items in the frontend based on selected tags.

image

keyteq/cloudinary-metaindexer

Indexes cloudinary account to a mongodb database, and makes it available to list items in the frontend based on selected tags.

  • Friday, April 20, 2018
  • by peec
  • Repository
  • 10 Watchers
  • 1 Stars
  • 28 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 5 Versions
  • 17 % Grown

The README.md

cloudinary-metaindexer

Indexes cloudinary account to a mongodb database, and makes it available to list items in the frontend based on configured tags AND/OR a folder prefix., (*1)

This way you can create custom eZ pages that only lists cloudinary resources tagged with certain tags or within a cloudinary folder., (*2)

Prerequisites

  • eZ Publish 5.4+ or eZ Platform
  • PHP 5.5+
  • Mongodb installed on the server. And php extension for mongodb installed.
  • A cloudinary account.
  • A cron job (see doc below)

INSTALL

Step 1

If you are running PHP 5.6+ / 7+ you don't have the old ext-mongo installed. Doctrine ODM 1.X requires ext-mongo, but there is a adapter available for this case., (*3)

You need to install this adapter for mongodb (PHP 5.6+ / 7+):, (*4)

Note: If you have PHP version less then PHP 5.6 - skip this step., (*5)

composer require alcaeus/mongo-php-adapter --ignore-platform-reqs

Step 2

Install this bundle (stable):, (*6)

composer require keyteq/cloudinary-metaindexer

Step 3 - (if you have doctrine mongodb installed from before)

If you have configured doctrine mongodb in your project for some other tasks you will need to disable the auto mapping for the cloudianry meta indexer bundle. That is ONLY if you have auto_mapping set to true., (*7)

Update your config.yml where doctrine_mongodb is configured:, (*8)


doctrine_mongodb: #... document_managers: default: auto_mapping: true mappings: # Disable mapping for cloudinary meta indexer bundle, it has its own document manager. KeyteqCloudinaryMetaIndexerBundle: mapping: false

CONFIGURE

Add to the app kernel to enable the bundle (app/AppKernel.php):, (*9)

new Keyteq\Bundle\CloudinaryMetaIndexer\KeyteqCloudinaryMetaIndexerBundle(),

Add required configuration (remember to change the database to something unique for your project)., (*10)

app/config/config.yml:, (*11)

keyteq_cloudinary_meta_indexer:
    cloudinary_api_key: '%cloudinary_key%'
    cloudinary_api_secret: '%cloudinary_secret%'
    cloudinary_cloud_name: '%cloudinary_cloud_name%'
    mongodb:
        server: ~
        database: 'myproject_cloudinary' # Change this to something unique for the project.

And update parameters.yml.dist:, (*12)

parameters:
    # ....
    cloudinary_cloud_name: ~
    cloudinary_key: ~
    cloudinary_secret: ~
    # ....

Run composer install to add your secret parameters., (*13)

composer install

Test cloudinary sync

php app/console keyteq:cloudinary-meta-indexer:sync

Setup a cron job to run mongodb sync

Setup a new cronjob to run the synchronization job:, (*14)

NOTE: change app/console toezpublish/console` depending on your eZ publish/platform version., (*15)

The below cron specification will run this job at 2:30 every night., (*16)

30 2 * * * php app/console keyteq:cloudinary-meta-indexer:sync

Import the cloudinary_page package

See Resources/ezcontentclass/ folder in this bundle, there is a content class that you can import via ez administration ui. That package includes a new content class named cloudinary_page and contains some mandatory attributes. You are free to add your own after you import the content class., (*17)

After imported, create a new content object of that specific class., (*18)

Extending the template with a pagelayout (required for 5.x of eZ)

Step 1 is required for 5.X of ezpublish., (*19)

Step 1

By default, we don't extend any template, so the layout will be empty ( no header and footer )., (*20)

  • Note: For 5.x use controller keyteq.cloudinary_meta_indexer.controller.full_view:viewCloudinaryPageLocation.
  • Note: If you are using layouts, use "ngcontent_view" instead of content_view.

Create your own override in yourezbundleconfig.yml:, (*21)

ezpublish:
    system:
        MY_FRONTPAGE_SITEACCESS:
            content_view:
                full:
                    cloudinary_page:
                        controller: keyteq.cloudinary_meta_indexer.controller.full_view:viewCloudinaryPage
                        template: "AcmeDemoBundle:content/full:cloudinary_page.html.twig"
                        match:
                            Identifier\ContentType: cloudinary_page

Customization of controller

Changing default 12 resources per page.

To set 24 resources per page for siteaccess YOUR_FRONT_SITEACCESS:, (*22)

parameters.yml:, (*23)

parameters:
    ezsettings.YOUR_FRONT_SITEACCESS.cloudinary_meta_indexer.resources_per_page: 24

Step 2

And create a new template for the cloudinary_page: AcmeDemoBundle/Resources/views/full/cloudinary_page.html.twig:, (*24)

{% extends "AcmeDemoBundle::pagelayout.html.twig" %}

{% block content %}
    {% include 'KeyteqCloudinaryMetaIndexerBundle:content/full:cloudinary_page.html.twig' %}
{% endblock %}

If you dont want the built in markup you can look inside the KeyteqCloudinaryMetaIndexerBundle:content/full:cloudinary_page.html.twig template and use certain parts of the template for your needs., (*25)

The Versions

20/04 2018

dev-master

9999999-dev https://github.com/keyteq/cloudinary-metaindexer

Indexes cloudinary account to a mongodb database, and makes it available to list items in the frontend based on selected tags.

  Sources   Download

GPL-2.0

The Requires

 

ezpublish ezplatform cloudinary keyteq cloudinary-metaindexer

20/04 2018

1.0.0-alpha4

1.0.0.0-alpha4 https://github.com/keyteq/cloudinary-metaindexer

Indexes cloudinary account to a mongodb database, and makes it available to list items in the frontend based on selected tags.

  Sources   Download

GPL-2.0

The Requires

 

ezpublish ezplatform cloudinary keyteq cloudinary-metaindexer

13/02 2018

1.0.0-alpha3

1.0.0.0-alpha3 https://github.com/keyteq/cloudinary-metaindexer

Indexes cloudinary account to a mongodb database, and makes it available to list items in the frontend based on selected tags.

  Sources   Download

GPL-2.0

The Requires

 

ezpublish ezplatform cloudinary keyteq cloudinary-metaindexer

07/12 2017

1.0.0-alpha2

1.0.0.0-alpha2 https://github.com/keyteq/cloudinary-metaindexer

Indexes cloudinary account to a mongodb database, and makes it available to list items in the frontend based on selected tags.

  Sources   Download

GPL-2.0

The Requires

 

ezpublish ezplatform cloudinary keyteq cloudinary-metaindexer

28/11 2017

1.0.0-alpha1

1.0.0.0-alpha1 https://github.com/keyteq/cloudinary-metaindexer

Indexes cloudinary account to a mongodb database, and makes it available to list items in the frontend based on selected tags.

  Sources   Download

GPL-2.0

The Requires

 

ezpublish ezplatform cloudinary keyteq cloudinary-metaindexer