Themes In Yii2: 'setting Unknown Property: Yii\web\view::pathmap'

I’ve got a Yii2 project with the advanced template that I’d like to theme. Since my themes might be used in either front or backend, I thought it might be best to throw them in the “common” area rather than duplicating them in both frontend and backend. So I did that and made the following setting in frontend/config/main.php:


'components' => [

		'view' => [

			'pathMap' => ['@app/views' => '../../common/themes/in-the-mountains'],

			'baseUrl' => '../../common/themes/in-the-mountains/files',

		], ...

However, when I try this out, I get the following error message:


exception 'yii\base\UnknownPropertyException' with message 'Setting unknown property: yii\web\View::pathMap'

I know that I must have missed something as I’m struggling to understand the new Yii which, despite the struggles, I’m coming to to like and enjoy every day that I work with it. However, this one’s got me stumped. I’ve check both the API docs and code, and pathMap is definitely there.

You have to configure the theme property of view component, something like this:




...

...

'view' => [

	'theme' => [

		'pathMap' => ['@app/views' => '@app/themes/basic/views'],

		'baseUrl' => '@web/themes/basic',

	],

],

...

...



Thanks a million. I completely forgot the ‘theme’ => [] part. I was focusing so much on how to work out referncing items stored in common from the frontend part of the app that I totally missed it.