Jump to content
rjgamer

Can I use the Fieldset name as API key?

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.

 

Share this post


Link to post
Share on other sites

@rjgamer

There is Fieldset (Page) that have desired API behavior ( it doesn't installed by default). 

You can read about it here.

  • Like 1

Share this post


Link to post
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

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.


  • Recently Browsing   0 members

    No registered users viewing this page.

×
×
  • Create New...