Jump to content

Setting a pages Icon and Sort Order programmatically


Recommended Posts

Hi All,

I am working on a module at the moment which in theory will create a few simple fields, templates and pages which will all be linked together.

All is going well so far, I have it generating said fields, templates and pages, however I would like to also set the pages sort order and icon programmatically at this stage also.

I have yet to see any documentation or any other threads where this has been brought up, is it even possible programmatically without interacting with the database directly?

This is the snippet which is generating my pages on the fly at the moment.

foreach($arrayOfPages as $name => $page)
{
	$p = new Page();
	$p->template = 'page';
	$p->name = $page['URL'];
	$p->title = $name;
	$p->parent = wire('pages')->get('name='.$page['parent']);

	//is it possible to set the icon and sort order at this point, before saving?

	$p->save();
}

 

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

×
×
  • Create New...