Jump to content

Recommended Posts

Posted

Is it possible to get the columnWidth of a field via the API?

Looks like columnWidth is stored in "data", not sure how I can access that.

$field->???

Posted
// via field settings
$field = $fields->get("title");
echo "width:" . $field->columnWidth;

// via template context
$tpl = $templates->get("basic-page");
$field = $tpl->fieldgroup->getField("title", true); // true for template context
echo "width:" . $field->columnWidth;

https://gist.github.com/somatonic/8323844

  • Like 5
Posted

Thanks Soma,

I was trying that with no luck. Then after you confirmed it should work, I realized that 100% width probably didn't output anything. 

Set the width to something less, and bingo!

Long day. :)

  • Like 2

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...