CMSB 3 default field width

5 posts by 3 authors in: Forums > CMS Builder
Last Post: February 9, 2016   (RSS)

By kitsguru - February 5, 2016

I am wondering what the default field withs are in the section editor and if tnere is an easy way to set it for older sections. i am finding going through and manually adjusting each field for all the sections very tedious.

Suggestions?

Jeff Shields

By kitsguru - February 9, 2016

Thanks Ross,

I used my text editor with regexp to replace all unassigned fieldWidth to large as my default, then found ones that had width set to a pixel value and set those to corresponding sizes. Now I only need to adjust a few by hand where large is too big or when full width is desired.

I use git for version control so never need backups as I can always revert the changes for any commit.

Jeff Shields

By ross - February 9, 2016

Hi Jeff

Sounds good Jeff.  Keep me up to date with how you are making out.

Thanks!

-----------------------------------------------------------
Cheers,
Ross Fairbairn - Consulting
consulting@interactivetools.com

Hire me! Save time by getting our experts to help with your project.
Template changes, advanced features, full integration, whatever you
need. Whether you need one hour or fifty, get it done fast with
Priority Consulting: http://www.interactivetools.com/consulting/

By Daryl - February 9, 2016

Hi Jeff,

I wrote a script that will convert field width pixels to CMSB 3.** size. 

If you're comfortable editing PHP files, you can try the following patch.

Search for the following code in "\cmsb\lib\menus\default\edit_functions.php"

$styleClassWidth = getBootstrapFieldWidthClass(@$fieldSchema['fieldWidth']);

and replace it with the following code:

  // get field width class
  $widthName      = @$fieldSchema['fieldWidth']; // eg: tiny, small, medium, large, full
  $isWidthNumeric = preg_match('/^\d+$/', $widthName);
  if ($isWidthNumeric) {  // convert legacy v2.xx field width pixels to named size (eg: 340 to small)
    $pixels = @$fieldSchema['fieldWidth'];
    if     (0 < $pixels   && $pixels <= 120)  { $widthName = "tiny"; }
    elseif (120 < $pixels && $pixels <= 340)  { $widthName = "small"; }
    elseif (340 < $pixels && $pixels <= 675)  { $widthName = "medium"; }
    elseif (675 < $pixels && $pixels <= 1010) { $widthName = "large"; }
    elseif (1010 < $pixels)                   { $widthName = "full"; }
  }
  $styleClassWidth = getBootstrapFieldWidthClass($widthName);   

Make sure to make a full backup first.

In the next CMSB release, we will add a support for legacy 2.** field width pixels by converting them to CMSB 3.** size natively.

Please let me know if you have any questions.

Thanks,

Daryl Maximo
PHP Programmer - interactivetools.com