Sipho

Get template's allowed templates for children from API

15 posts in this topic

I wish to access a template's allowed templates for it's children from the API. This one:

Capture.thumb.PNG.33eea507a44f413ed558867587d7d4da.PNG

I am pretty sure this is possible, but I can't seem to find it anywhere in the documentation. If this is not possible, is there some way of assigning properties to templates? So like fields that already have a value on all pages using that template.

Share this post


Link to post
Share on other sites

@tpr Yep that's worked. It returns the ids in an array. How did you find that out? I couldn't see it anywhere in the documentation.

Share this post


Link to post
Share on other sites

I needed this when one of my modules installed a few templates, I digged into the core as I remember.

Share this post


Link to post
Share on other sites

@tpr Ah, I found it in the database. I will keep that in mind when I want to know another property. But why isn't stuff like this documented? Is there any way people can contribute to the documentation?

Share this post


Link to post
Share on other sites

Oh my goodness that page is so obvious. I don't know how I missed it. Sorry for wasting your time!

Share this post


Link to post
Share on other sites

Another trick as mentioned by @Robin S somewhere I now can't find...Hover your mouse over the field's collapse/uncollapse arrow...the name of the  input usually matches the API...;)

api-from-field-name.thumb.png.9ed822149ba27fb66eca1e45b4b830c2.png

 

1 person likes this

Share this post


Link to post
Share on other sites
22 minutes ago, Sipho said:

For some reason I can't get that to show up. When I hover my mouse over it it just says "Toggle open/close".

Hmm. What version of PW? It shows for me in 2.7 and 3.0.62.

Share this post


Link to post
Share on other sites

Not sure but I seem to recall reading that either debug mode or advanced mode triggered the field name display when hovering.

1 person likes this

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.

  • Similar Content

    • By didhavn
      Hey everbody.

      I wanted to share something I have been working for quite some time, in total currently three premium Templates or Site-Profiles for ProcessWire 3 including a onepage template, a blog template and a blog+sidebar template.
       
      Here are some Quick Facts:
      Fully responsive Multilanguage support Full SEO support Optional Google Analytics Easily create new pages out of multiple predefined sections Lazyload the sections of a page [Group and update website-information into blogs] (blog, blog+sidebar) [Use tags to tag and group blog entries] (blog, blog+sidebar) [User-comments] (blog, blog+sidebar) [Create each page with or without sidebar] (blog+sidebar) Website-wide search by text or tags Password protect each page individually with sophisticated page-encryption with dummy texts and pixelated images
      Just go to https://pwtemplates.de to test the demos (e.g. blog-sidebar) and purchase them for a small expense allowance.
       

      Hope you like it!
    • By Mirza
      Hi All,
      I have created a script which will create the pages and it should be unpublished.
      I have added the status as unpublished by default while first time saving the page as below.
      $hotelPage->hotel_website = $hotel['hotelWebsite']; // By default page created will be unpublished state $hotelPage->addStatus(Page::statusUnpublished); $hotelPage->save(); $hotelPage->setOutputFormatting(false); // Add hotel images only after setting output formatting to false $hotelPage->images->add($hotel['hotelImage']); $hotelPage->save(); On the same time, saving the hotel image as well and triggering the save method.
      But when I see the created page in the tree, Its shows unpublished but publish_date is not empty(date will be present as created, modified and published are all same)
      Now I don't understand why the date is getting filled into the publish field for a page?
      Please let me know if am doing something wrong.
    • By benbyf
      Hello,
      Does anyone know whether the is a place detailing the structure your admin theme should take when creating one? e.g. I see UiKit, Reno and Default admin themes all have default.php, init.php, controller.php files, is this a stylisitic choice or a prerequisite for any admin theme module?
      Thanks!
    • By csaba
      Hello,
      Pleased to meet you,my name is Csaba and I'm from Hungary.
      I've just installed processwire to more places.
      I created new parent and children pages.
      The children page links are not displayed on the right side of the parent pages.
      The sample About page is ok, Child page example 1 and Child page example 2 links are visible and live.
      But my child pages are not displayed on the parent pages.
      Please help!
       
    • By bmacnaughton
      I am using the translation function (either $this->_() or __()) within a module that responds to AJAX API calls - there isn't really a page that is being served.
      When I supply a string with an apostrophe, e.g.,
      __('Book \'em danno') It is formatted as
      Book 'em danno  
      Is there some way to prevent output formatting when retrieving strings using the translation functions?