Skip to content

Commit

Permalink
PCC-00: Adding documentation. (#25)
Browse files Browse the repository at this point in the history
* PCC-00: Adding documentation.

* PCC-00: Adding documentation.

* PCC-00: Adding documentation.
  • Loading branch information
purushotamrai authored Jun 20, 2024
1 parent 6efc867 commit 98f7000
Show file tree
Hide file tree
Showing 5 changed files with 150 additions and 0 deletions.
108 changes: 108 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,111 @@
# PCX Connect | PCC Integration

Drupal Module for PCC Integration

## Pre-requisite

PCX Connect allows Drupal integration with multiple PCC Sites. As a pre-requisite, we need the following:

- PCC Site ID & Token
(Refer to [Managing PCC Sites](#managing-pcc-sites) to know more about how to create a PCC site or access an existing site)

- Google Drive Integrated with Pantheon Content Cloud
(Refer to [Content Creation Guide](https://pcc.pantheon.io/docs/pantheon-content-cloud-installation-instructions) to
connect Google with PCC Site)

## Managing PCC Sites

PCC Sites are managed by PCC Cli. Refer to [Pantheon Developer Guide](https://pcc.pantheon.io/docs/pcc-cli-setup) to
setup `pcc-cli` and then we can create PCC Site(s).

### Creating a PCC Site

1. Create a PCC Site using `pcc-cli` to get the site ID:

```pcc site create --url mydomain.com```

And PCC Site Token as:

```pcc token create```

More details here: [Pantheon Guide | PCC Variables](https://pcc.pantheon.io/docs/required-pcc-variables)

2. Once we have PCC Site ID & Token, we can create / manage Drupal PCC Site at `/admin/structure/pcc_sites`

![Create PCC Site](./screenshots/create-pcc-site.png)

**Note: For Reference, the PCX Connect module ships an example connected PCC Site.**

## Managing content display of PCC Site

Once the PCC Site is created and added in Drupal, we can display content from PCC Site (the connected Google Drive).

### Creating Listing of the content

To create a listing of the content from PCC site, create a view to show `PCC Site - Site Name`. We have the following
fields, filters, sorting and pagination available:

![Create View - Show PCC Site](./screenshots/create-pcc-site-views.png)

#### Available fields

- ID
- Slug
- Title
- Content
- Snippet
- Tags
- Metadata
- Published Date
- Updated At
- Publishing Level

#### Metadata fields

PCX Connect module also supports Metadata fields. Search for Metadata field, add the field, select one of the available
metadata fields.

#### Filtering, Sorting and Pagination

Following features are supported for views:

##### Filtering

Module supports Views content filtering for `Title`, `Content`, `Tags` fields for now. Additionally, usage is limited to
`is equal to` operator while it corresponds to search docs using `contains` operator via PCC API.

##### Sorting

Module supports Views content sorting for `Published Date` and `Updated At`.

##### Pagination

For now, the module supports Mini pager.

### Creating individual page for each content

This can be achieved using contextual filters.

#### Contextual Filter

Following contextual filters are fully supported that can help in building individual content pages:

- Slug
- ID

### Live Preview of content

PCX Connect module installs optionally `pantheon_cloud_api` view that creates route `/api/pantheoncloud/document/%` for
integration with Pantheon Content Cloud. This uses `Publishing Level` contextual filter. Preview supports auto-refresh.

## Smart Components Integration | PCC | Submodule

For integration with PCC Smart Components, please review and enable `pcx_smart_components` submodule.

## Examples

PCX Connect module by default would create PCC Site configuration for demo purposes. Additionally, View
`blogs` and `pantheon_cloud_api` are installed, to show a sample content listing page at `/blogs` and also creates
individual pages (`/blogs/{slug}`) for these blog contents.

And the `pantheon_cloud_api` view is responsible for Live Preview feature.
42 changes: 42 additions & 0 deletions modules/pcx_smart_components/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
# Smart Components Integration | PCC

Pantheon Content Cloud supports custom components which actually are owned by Drupal (in our case), but available in
Google Docs to be added as content (via PCC Google Docs Add-on). Read More about [Smart Components](https://pcc.pantheon.io/docs/content-cloud-smart-custom-components)

## Managing Single Directory Component (SDC) as Smart Component

This module enables usage of Drupal Single Directory Components (SDC) to be integrated as PCC Smart Component. This
gives Drupal flexibility to define the component (properties, output, assets) while Google Docs can embed them as
content, and finally Drupal controls rendering of these components.

### Creating SDC (PCC Component)

Creating SDC for PCC Integration is simple, just set `pcc_component: true` for the component and these components, would
be available in Google Docs (via Add-on). A sample SDC component (PCX Smart Component Basic) is available with this
module be default.

### Adding smart component to PCC Site Content (via Google Docs)

To ensure SDC components are available as smart component for Google Docs, validate following route
`/api/pantheoncloud/component_schema`

![Create View - Show PCC Site](./screenshots/api-component-schema.png)

This list contains SDC as smart components that are available for Google Docs Add-on

### Rendering Smart Component

This module supports smart components in `pcc_content` views field and would automatically render the smart component
based on SDC rendering.

As of now, module supports the following SDC property types

- string
- boolean
- object
- number

Following properties have not been tested:

- array
- enum
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added screenshots/create-pcc-site-views.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added screenshots/create-pcc-site.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit 98f7000

Please sign in to comment.