english/administrator/components/com_menus/models/item.php
/**
	 * Auto-populate the model state.
	 *
	 * Note. Calling getState in this method will result in recursion.
	 *
	 * @return	void
	 * @since	1.6
	 */
Auto-populate the model state.
Note. Calling getState in this method will result in recursion.


Auto - populate the model state . Note . Calling getState in this method will result in recursion .
protected function populateState()
	{
		$app = JFactory::getApplication('administrator');
		$pk = (int) JRequest::getInt('id');
		$this->setState('item.id', $pk);
		if (!($parentId = $app->getUserState('com_menus.edit.item.parent_id'))) {
			$parentId = JRequest::getInt('parent_id');
		}
		$this->setState('item.parent_id', $parentId);
		if (!($menuType = $app->getUserState('com_menus.edit.item.menutype'))) {
			$menuType = JRequest::getCmd('menutype', 'mainmenu');
		}
		$this->setState('item.menutype', $menuType);
		if (!($type = $app->getUserState('com_menus.edit.item.type'))){
			$type = JRequest::getCmd('type');
		}
		$this->setState('item.type', $type);
		if ($link = $app->getUserState('com_menus.edit.item.link')) {
			$this->setState('item.link', $link);
		}
		$params	= JComponentHelper::getParams('com_menus');
		$this->setState('params', $params);
	}
protected function populateState ( ) { $ app = JFactory :: getApplication ( 'administrator' ) ; $ pk = ( int ) JRequest :: getInt ( 'id' ) ; $ this -> setState ( 'item.id' , $ pk ) ; if ( ! ( $ parentId = $ app -> getUserState ( 'com_menus.edit.item.parent_id' ) ) ) { $ parentId = JRequest :: getInt ( 'parent_id' ) ; } $ this -> setState ( 'item.parent_id' , $ parentId ) ; if ( ! ( $ menuType = $ app -> getUserState ( 'com_menus.edit.item.menutype' ) ) ) { $ menuType = JRequest :: getCmd ( 'menutype' , 'mainmenu' ) ; } $ this -> setState ( 'item.menutype' , $ menuType ) ; if ( ! ( $ type = $ app -> getUserState ( 'com_menus.edit.item.type' ) ) ) { $ type = JRequest :: getCmd ( 'type' ) ; } $ this -> setState ( 'item.type' , $ type ) ; if ( $ link = $ app -> getUserState ( 'com_menus.edit.item.link' ) ) { $ this -> setState ( 'item.link' , $ link ) ; } $ params = JComponentHelper :: getParams ( 'com_menus' ) ; $ this -> setState ( 'params' , $ params ) ; }
Auto-populate the model state.
Auto - populate the model state .
// Load the User state. // Note a new menu item will have no field type. // The field is required so the user has to change it. // Load the parameters.