Download the PHP package tfd/statamic-content-modules without Composer

On this page you can find all versions of the php package tfd/statamic-content-modules. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package statamic-content-modules

Content Modules

Content Modules is a Statamic addon that allows you to easily modify and add data to custom set view templates for replicator or bard fields.

How to install

Run the following command from your project root:

How to use

In bard and replicator fields you can dynamically piece together content sets in whatever order and arrangement you imagine. To better control the data and appearance of the content sets, this addon allows you to write custom PHP classes and view templates for these sets. General information can be found on https://statamic.dev/view-models.

1. Create view model class

Your first step is to create a view model class that extends the addon's ViewModel.


2. Inject view model class into

This class now has to be injected into your collection's view, e. g.:


3. Adapt default template file

In the template view, that renders your content (default.antlers.html by default), all sets are included as an array. To iterate over each set you have to change this template file, e. g.:

The content variable has to match the handle of your bard or replicator field.

If you use different handles for different collections, you can create a new view model class for every collection and set a custom field handle:

Do not forget to change the template variable inside your template view: it has to match your custom field handle.


4. Create a view for your custom set

As you can see the example in section 3. includes a partial from modules/{type}. The type variable automatically resolves to the handle of a set (You define your sets when creating the content field inside your blueprint. It has to be a bard or replicator field type.)

If you have a set with the handle gallery you have to create a modules/gallery.antlers.html template to render its contents.

You have to repeat this step for all of your sets.


5. (optional) Create a custom content modules PHP class for every set

If you want to modify data for a content module, you can create a new PHP class, e. g. for your gallery set:

The data() method will be called automatically. Any modified or added data is then available in your content module's template:

If you do not create custom PHP classes for your sets you always can customize each view template for your sets with custom markup.


All versions of statamic-content-modules with dependencies

PHP Build Version
Package Version
Requires statamic/cms Version ~3.1.0 || ~3.2.0 || ^3.3 || ^4.0 || ^5.0
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package tfd/statamic-content-modules contains the following files

Loading the files please wait ....