Skip to content

A user-definable table field type for Craft CMS

License

Notifications You must be signed in to change notification settings

Goldinteractive/craft-tablemaker

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

60 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Table Maker Plugin for Craft CMS

Let your users define their own table columns in your Craft control panel.

Table Maker

Installation

You can install Table Maker via the plugin store, or through Composer.

Craft Plugin Store

To install Table Maker, navigate to the Plugin Store section of your Craft control panel, search for Table Maker, and click the Try button.

Composer

You can also add the package to your project using Composer and the command line.

  1. Open your terminal and go to your Craft project:
cd /path/to/project
  1. Then tell Composer to require the plugin, and Craft to install it:
composer require verbb/tablemaker && php craft plugin/install tablemaker

Usage

There are two ways you can go about templating a table: use the built-in html output or access the column and row data directly to code your own.

Automatic table output

This will simply output a valid html table:

{{ entry.myTableField.table }}

Code your own

Should you want more control over the output you can just access the column and row data directly instead using {{ entry.myTableField.columns }} and {{ entry.myTableField.rows }}.

Here is an example of how you might do just that:

<table>
    <thead>
        <tr>
            {% for col in entry.myTableField.columns %}
                <th align="{{ col.align }}" width="{{ col.width }}">{{ col.heading }}</th>
            {% endfor %}
        </tr>
    </thead>

    <tbody>
        {% for row in entry.myTableField.rows %}
            <tr>
                {% for cell in row %}
                    <td align="{{ entry.myTableField.columns[loop.index0].align }}">{{ cell }}</td>
                {% endfor %}
            </tr>
        {% endfor %}
    </tbody>
</table>

Note that when looping rows you can use the current loop index to find the appropriate alignment value for that column.

Credits

Originally created by the team at Supercool Ltd.

Show your Support

Table Maker is licensed under the MIT license, meaning it will always be free and open source – we love free stuff! If you'd like to show your support to the plugin regardless, Sponsor development.

About

A user-definable table field type for Craft CMS

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Languages

  • PHP 75.4%
  • JavaScript 20.3%
  • HTML 3.7%
  • SCSS 0.6%