Fetch query from parent page

Yes, you can do that via a custom form field : http://getkirby.com/docs/panel/custom-form-fields

You can adapt this example by just replacing the value for $categories with the structure fields:

<?php

class CategoryField extends BaseField {

  public function __construct() {
    $this->type    = 'category';
    $this->icon    = 'chevron-down';
    $this->label   = 'category';
    $this->options = array();

  }  
public function options() {
    return FieldOptions::build($this);
  }
  public function option($value, $text, $selected = false) {
    return new Brick('option', $this->i18n($text), array(
      'value'    => $value,
      'selected' => $selected
    ));
  }
  	public function input() {
  		$select = new Brick('select');
  		$select->addClass('selectbox');
  		$select->attr(array(
	      'name'         => $this->name(),
	      'id'           => $this->id(),
	      'required'     => $this->required(),
	      'autocomplete' => $this->autocomplete(),
	      'autofocus'    => $this->autofocus(),
	      'readonly'     => $this->readonly(),
	      'disabled'     => $this->disabled(),
	    ));
  	    
    $select = $select->append($this->option('', '', $this->value() == ''));

  	
  	if($this->readonly()) {
      $select->attr('tabindex', '-1');
    }

//this part uses a field with a comma separated list, replace this with the structure field
    if($this->page()->parent()->categories() != "") {
      $categories = $this->page()->parent()->categories()->split();
    }
    else  {
      $categories = site()->categories()->split();
    }
   
    foreach($categories as $category)  {
      $this->options[$category] = $category;
    }

    foreach($this->options() as $value => $text) {
      $select->append($this->option($value, $text, $this->value() == $value));
    }

    $inner = new Brick('div');
    $inner->addClass('selectbox-wrapper');
    $inner->append($select);

    $wrapper = new Brick('div');
    $wrapper->addClass('input input-with-selectbox');
    $wrapper->append($inner);

    if($this->readonly()) {
      $wrapper->addClass('input-is-readonly');
    } else {
      $wrapper->attr('data-focus', 'true');
    }

    return $wrapper;
  	
  }

}
1 Like