Jump to content
Juergen

Fieldtype ObjectDimensions - relaunch of Fieldtype Dimensions with new features

Recommended Posts

Hello @ all

Today I want to share an inputfield/fieldtype to store 2 or 3 dimensions of an object.

This fieldtype was inspired by the amazing fieldtype "Fieldtype Dimensions" from SOMA (https://modules.processwire.com/modules/fieldtype-dimension/). This fieldtype was introduced in 2013 - so its time for a relaunch. This new fieldtype offers more possibilities than the old one from SOMA.

This inputfield/fieldtype let you enter max. 3 dimensions (width/height/depth) of an object (fe a product), but you can select if you want to display inputs for 2 or 3 dimensions. 2 dimension can be used fe for wallpapers or photos, 3 dimensions fe  for furnitures or other objects.

objectdimensions1.thumb.png.94ea5be48963f4ff844799238c54b668.png

objectdimensions2.thumb.png.fde67e1389b3531c657aad4d9914af6f.png

There are several configuration options for this fieldtype in the backend.

  • set type (2 or 3 dimensional)
  • set width attribute for the inputfield in px (default is 100px)
  • set size unit as suffix after each inputfield (default is cm)
  • set max number of digits that can be entered in each field (default is 10)
  • set max number of decimals (default is 2)
  • show/hide a hint to the user how much digits/decimals are allowed

If the number of decimals or digits will be changed, the database schema for each dimension column will also change after saving the field in the backend.

For example:

If the schema for each dimension field in the DB is f.e. decimal(10,2) and you will set the number of digits in the configuration to 12 and the number of decimals to 1, then the schema in the DB will also change to decimal(12,1) after saving the inputfield.

You can download this inputfield at https://github.com/juergenweb/FieldtypeObjectDimensions

There you will find more detailed information and explanation too.

If you find any bugs or you have an idea to improve it (also code improvements) please report it on Github.

Have a nice day!

 

  • Like 15

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

  • Recently Browsing   0 members

    No registered users viewing this page.

×
×
  • Create New...