Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Comment: Minor typos and cleanup

...

Excerpt

By the end of this unit, we should have an understanding of how FarCry navigates our project and plugins to find both content type metadata and relevent relevant webskin locations.

Plugins

...

Every aspect of a project can be repackaged and used in another project as a plugin. This might be the entire project or just a small part of it. Most applications are combinations of several plugins. Community plugins include solutions for Google Maps, blogging, content management, free-text search engines and many, many more.

In essence, any FarCry application is a seamless merger of the core framework, the library of plugins associated with the application and the project itself. The project inherits everything represented in the collection of core, plugins and project code bases and is available in the running application. Importantly, if the same code is present in more than one location then , a cascade model comes into play so that developers can change or override the behaviour of inherited functionality.

...

If you nominate a plugin during the initial installation of your project, its code and content types should be automatically registered and deployed. However, if you are deploying a plugin to an established project you will need to get your hands just a little bit dirty.

...

  1. Download the Google Maps Plugin
  2. Copy the code base to the plugins folder of your installation
  3. Update your farcryConstructor.cfm configuration file to include GoogleMaps
  4. Re-initialise the application
  5. Go to the Admin > Developer Utilities > COAPI Tools > Types and deploy the Google Maps content types
  6. Go to the Admin > Developer Utilities > COAPI Tools > Rules and deploy the Google Maps publishing rules
  7. Login to the webtop and update the Config for Google Maps with your API key
  8. Create a publish a Google Map

Plugins & Content Types

Order of metadata initialization for typesNow that we understand the cascading relationship between FarCry Core, Plugins and a Project, the order of initialisation of the metadata for a particular content type is straightforward.

A good example is the superhero Super Hero content type we created.:

  1. FarCry will find our content type definition (cfc) in

...

  1. /farcry/core/projects/superheroes/packages/types/superhero.cfc
  2. It will then add all the property metadata into the application scope (application.stcoapi.superhero.stprops)
  3. It will then introspect the content type that it extends

...

  1. (in this case it is

...

  1. /farcry/core/packages/types/types.cfc)

So it adds all the property metadata it finds here into our application.stcoapi.superhero.stprops. As a result we have application.stcoapi.superhero.stProps filled with the combination of all the properties in both those content types. We can see this using the COAPI Scope Dumper located in the webtop Admin > Developer Utilities > Scope Dump.

Tip
titleScope Dump

If you know the exact structure your are looking for you can type it up the top and click [dump], or browse using the preset scopes listed on the left of the viewer.

...

Walkthrough: Extending the News Content Type

Using this concept, we are going to extend the dmNews.cfc found in the farcrycms plugin and add some new properties.

  1. create Create a new file in projectName/farcry/projects/superheroes/packages/types/dmNews.cfc
  2. paste Paste the following. :
    Code Block
    <cfcomponent
       extends="farcry.plugins.farcrycms.packages.types.dmNews"
       displayname="News"
       hint="Dynamic news data">
    <cfproperty
       name="author" type="string"
      ftSeq="10" ftFieldset="Publishing Details" ftwizardStepftWizardStep="General Details" ftLabel="Author" />
    </cfcomponent>
    
  3. Notice the value of extends. This : this says we are extending the properties and functionality found in farcry.plugins.farcrycms.packages.types.dmNews
  4. Deploy our new property
  5. Update our COAPI Metadata
  6. Create a new News item in the webtop from "Content / CMS Content / News"
  7. Notice our new author property now located in the correct position in the wizard.

Webskin Inheritance

Once all of the types have been initialized in the fashion above, FarCry then finds all the webskins that are relevent relevant for each type.

In the case of the superherosuperHero.cfc above, FarCry trawls through the folders in a predefined order to find any relevent relevant webskins.

At this point it is important to remember that we have included 2 plugins into our project (farcrycms ,and farcrygreybox). So , so this process will include those plugins in its search to find relevent relevant webskins.

So, in In this case it will look in the following order for webskins for superhero.cfc:

Code Block
/farcry/projects/superhero/webskins/superhero
/farcry/projects/superhero/webskins/types
/farcry/plugins/farcrygreybox/webskins/superhero
/farcry/plugins/farcrygreybox/webskins/types
/farcry/plugins/farcrycms/webskins/superhero
/farcry/plugins/farcrycms/webskins/types
/farcry/core/webskins/superhero
/farcry/core/webskins/types

Therefore ALL webskins in any of those locations will be available to the superhero superHero content type. It is also important to note that only the FIRST webskin of the same name will be used. So, if we have a displayTeaserStandard in 2 two of these folders, the first one the process comes across will be the one the project uses.

This allows us to both override behaviour perhaps defined in core or a plugin and so on.

...

Lab: Override the displayPageFull News Webskin

Go ahead and update the full page display webskin for dmNews to include the new "Author" author property.