Jump to content

FieldsetOpen


Manol
 Share

Recommended Posts

Finally I got it.

Here is the code and a couple of self explanatory images to show what you have and what you get.

post-1191-0-65711500-1444820045_thumb.pn

post-1191-0-67368500-1444820053_thumb.pn

	protected function getFieldsets( $pageID ){

		$pagina = wire('pages')->get($pageID);

		$campos = array(); $array = array();  $temp = null;

		foreach($pagina->fields as $field) {

			if($field->type->name == "FieldtypeFieldsetOpen") {
				$temp = $field->name;
			}
			elseif($field->type->name == "FieldtypeFieldsetClose") {
				$campos = array(); $temp = null;
			}
			else {
				if($temp!=null){
					array_push($campos, $field->name); $array[$temp]= $campos;
				}	
			}

	    }

		return json_encode($array);

	}
  • Like 1
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...