Page tree

Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Code Block
/**
@param $param
@return MobileApp
*/
public function getAppSetting($param)
{
	$app = new MobileApp('post', [
		'title' => 'Posts',
		'home_view' => 'menu',
		'main_resource' => new PostResource([])
		]); 
	// Add create post button on App's home screen
	$app->addSetting('home.header_buttons', [
		'post' => [
			[
				'icon' => 'plus',
				'action' => Screen::ACTION_ADD,
				'params' => [
				'resource_name' => 'post',
				'module_name' => 'post'
			]
		]
	]
]); 
	return $app;
} 

 

Step 2: Create the creation form

 

Native Mobile App allows creating forms via API. The form API returns the structure of a form in JSON and base on the structure Mobile App automatic create a screen with form, fields and drive submit action.
The GeneralForm class as a base class helps build forms and handle submission, validation... You can create a post Post form as following code
PostForm.php

...