Jump to content

Can I use the Fieldset name as API key?


rjgamer
 Share

Recommended Posts

Hi folks,

I'm new to PW and have to say: I really like it! After 15 years of using WebsiteBaker or similar forks of it, I'm ready to switch to ProcessWire.

I'm handling the site-wide settings in a Fieldset-tab in home-page:

screen1.thumb.JPG.ad43865a9f4983f32c2742a6afcb48e0.JPG

Can I use the Fieldset name as API key? Because currently on my installation, the name of the fieldset is not accessible as WireData/array and returns null:

$home = $pages->get('/');
echo $home->site_settings->site_title; // does not work, throws error because site_settings is null
echo $home->site_title; // does work

If configurable, I want the similiar API-behaviour of fieldset to access the child fields like with the repeater.

Thanks for your support.

 

Link to comment
Share on other sites

Fieldsets are only logical groups, but they don't change how data is stored/retrieved. Each field in a fieldset still is a direct child of the page and any nesting is only presentational. If you want nesting we have https://processwire.com/blog/posts/processwire-3.0.73-and-new-fieldset-types/#fieldset-page-fieldtypefieldsetpage. This is real nesting with another page behind the scenes, which does also allow things like reusing a field in the "fieldset" as well as in the parent page.

  • Like 2
Link to comment
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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...