Passed
Push — master ( 154e9f...c95a25 )
by Aimeos
03:44
created

Standard::delete()   B

Complexity

Conditions 6
Paths 46

Size

Total Lines 51
Code Lines 29

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 6
eloc 29
nc 46
nop 0
dl 0
loc 51
rs 8.8337
c 0
b 0
f 0

How to fix   Long Method   

Long Method

Small methods make your code easier to understand, in particular if combined with a good name. Besides, if your method is small, finding a good name is usually much easier.

For example, if you find yourself adding comments to a method's body, this is usually a good sign to extract the commented part to a new method, and use the comment as a starting point when coming up with a good name for this new method.

Commonly applied refactorings include:

1
<?php
2
3
/**
4
 * @license LGPLv3, http://opensource.org/licenses/LGPL-3.0
5
 * @copyright Aimeos (aimeos.org), 2017-2018
6
 * @package Admin
7
 * @subpackage JQAdm
8
 */
9
10
11
namespace Aimeos\Admin\JQAdm\Catalog;
12
13
sprintf( 'catalog' ); // for translation
14
15
16
/**
17
 * Default implementation of catalog JQAdm client.
18
 *
19
 * @package Admin
20
 * @subpackage JQAdm
21
 */
22
class Standard
23
	extends \Aimeos\Admin\JQAdm\Common\Admin\Factory\Base
24
	implements \Aimeos\Admin\JQAdm\Common\Admin\Factory\Iface
25
{
26
	/**
27
	 * Copies a resource
28
	 *
29
	 * @return string HTML output
30
	 */
31
	public function copy()
32
	{
33
		$view = $this->getView();
34
		$context = $this->getContext();
35
36
		try
37
		{
38
			if( ( $id = $view->param( 'id' ) ) === null ) {
39
				throw new \Aimeos\Admin\JQAdm\Exception( sprintf( 'Required parameter "%1$s" is missing', 'id' ) );
40
			}
41
42
			$manager = \Aimeos\MShop::create( $context, 'catalog' );
43
			$view->item = $manager->getItem( $id, $this->getDomains() );
44
45
			$view->itemData = $this->toArray( $view->item, true );
46
			$view->itemSubparts = $this->getSubClientNames();
47
			$view->itemRootId = $this->getRootId();
48
			$view->itemBody = '';
49
50
			foreach( $this->getSubClients() as $idx => $client )
51
			{
52
				$view->tabindex = ++$idx + 1;
53
				$view->itemBody .= $client->copy();
54
			}
55
		}
56
		catch( \Aimeos\MShop\Exception $e )
57
		{
58
			$error = array( 'catalog-item' => $context->getI18n()->dt( 'mshop', $e->getMessage() ) );
59
			$view->errors = $view->get( 'errors', [] ) + $error;
60
			$this->logException( $e );
61
		}
62
		catch( \Exception $e )
63
		{
64
			$error = array( 'catalog-item' => $e->getMessage() . ', ' . $e->getFile() . ':' . $e->getLine() );
65
			$view->errors = $view->get( 'errors', [] ) + $error;
66
			$this->logException( $e );
67
		}
68
69
		return $this->render( $view );
70
	}
71
72
73
	/**
74
	 * Creates a new resource
75
	 *
76
	 * @return string HTML output
77
	 */
78
	public function create()
79
	{
80
		$view = $this->getView();
81
		$context = $this->getContext();
82
83
		try
84
		{
85
			$data = $view->param( 'item', [] );
86
87
			if( !isset( $view->item ) ) {
88
				$view->item = \Aimeos\MShop::create( $context, 'catalog' )->createItem();
89
			}
90
91
			$data['catalog.siteid'] = $view->item->getSiteId();
92
			$data['catalog.parentid'] = $view->item->getParentId() ?: $view->param( 'parentid', $view->param( 'item/catalog.parentid' ) );
93
94
			$view->itemSubparts = $this->getSubClientNames();
95
			$view->itemRootId = $this->getRootId();
96
			$view->itemData = $data;
97
			$view->itemBody = '';
98
99
			foreach( $this->getSubClients() as $idx => $client )
100
			{
101
				$view->tabindex = ++$idx + 1;
102
				$view->itemBody .= $client->create();
103
			}
104
		}
105
		catch( \Aimeos\MShop\Exception $e )
106
		{
107
			$error = array( 'catalog-item' => $context->getI18n()->dt( 'mshop', $e->getMessage() ) );
108
			$view->errors = $view->get( 'errors', [] ) + $error;
109
			$this->logException( $e );
110
		}
111
		catch( \Exception $e )
112
		{
113
			$error = array( 'catalog-item' => $e->getMessage() . ', ' . $e->getFile() . ':' . $e->getLine() );
114
			$view->errors = $view->get( 'errors', [] ) + $error;
115
			$this->logException( $e );
116
		}
117
118
		return $this->render( $view );
119
	}
120
121
122
	/**
123
	 * Deletes a resource
124
	 *
125
	 * @return string|null HTML output
126
	 */
127
	public function delete()
128
	{
129
		$view = $this->getView();
130
		$context = $this->getContext();
131
132
		$manager = \Aimeos\MShop::create( $context, 'catalog' );
133
		$manager->begin();
134
135
		try
136
		{
137
			if( ( $ids = $view->param( 'id' ) ) === null ) {
138
				throw new \Aimeos\Admin\JQAdm\Exception( sprintf( 'Required parameter "%1$s" is missing', 'id' ) );
139
			}
140
141
			$search = $manager->createSearch()->setSlice( 0, count( (array) $ids ) );
142
			$search->setConditions( $search->compare( '==', 'catalog.id', $ids ) );
143
			$items = $manager->searchItems( $search, $this->getDomains() );
144
145
			foreach( $items as $item )
146
			{
147
				$view->item = $item;
148
149
				foreach( $this->getSubClients() as $client ) {
150
					$client->delete();
151
				}
152
153
				$manager->saveItem( $view->item );
154
			}
155
156
			$manager->deleteItems( array_keys( $items ) );
157
			$manager->commit();
158
159
			$this->nextAction( $view, 'search', 'catalog', null, 'delete' );
160
			return;
161
		}
162
		catch( \Aimeos\MShop\Exception $e )
163
		{
164
			$error = array( 'catalog-item' => $context->getI18n()->dt( 'mshop', $e->getMessage() ) );
165
			$view->errors = $view->get( 'errors', [] ) + $error;
166
			$this->logException( $e );
167
		}
168
		catch( \Exception $e )
169
		{
170
			$error = array( 'catalog-item' => $e->getMessage() . ', ' . $e->getFile() . ':' . $e->getLine() );
171
			$view->errors = $view->get( 'errors', [] ) + $error;
172
			$this->logException( $e );
173
		}
174
175
		$manager->rollback();
176
177
		return $this->search();
178
	}
179
180
181
	/**
182
	 * Returns a single resource
183
	 *
184
	 * @return string HTML output
185
	 */
186
	public function get()
187
	{
188
		$view = $this->getView();
189
		$context = $this->getContext();
190
191
		try
192
		{
193
			if( ( $id = $view->param( 'id' ) ) === null ) {
194
				throw new \Aimeos\Admin\JQAdm\Exception( sprintf( 'Required parameter "%1$s" is missing', 'id' ) );
195
			}
196
197
			$manager = \Aimeos\MShop::create( $context, 'catalog' );
198
199
			$view->item = $manager->getItem( $id, $this->getDomains() );
200
			$view->itemSubparts = $this->getSubClientNames();
201
			$view->itemData = $this->toArray( $view->item );
202
			$view->itemRootId = $this->getRootId();
203
			$view->itemBody = '';
204
205
			foreach( $this->getSubClients() as $idx => $client )
206
			{
207
				$view->tabindex = ++$idx + 1;
208
				$view->itemBody .= $client->get();
209
			}
210
		}
211
		catch( \Aimeos\MShop\Exception $e )
212
		{
213
			$error = array( 'catalog-item' => $context->getI18n()->dt( 'mshop', $e->getMessage() ) );
214
			$view->errors = $view->get( 'errors', [] ) + $error;
215
			$this->logException( $e );
216
		}
217
		catch( \Exception $e )
218
		{
219
			$error = array( 'catalog-item' => $e->getMessage() . ', ' . $e->getFile() . ':' . $e->getLine() );
220
			$view->errors = $view->get( 'errors', [] ) + $error;
221
			$this->logException( $e );
222
		}
223
224
		return $this->render( $view );
225
	}
226
227
228
	/**
229
	 * Saves the data
230
	 *
231
	 * @return string HTML output
232
	 */
233
	public function save()
234
	{
235
		$view = $this->getView();
236
		$context = $this->getContext();
237
238
		$manager = \Aimeos\MShop::create( $context, 'catalog' );
239
		$manager->begin();
240
241
		try
242
		{
243
			$item = $this->fromArray( $view->param( 'item', [] ) );
244
			$view->item = $item->getId() ? $item : $manager->saveItem( $item );
245
			$view->itemBody = '';
246
247
			foreach( $this->getSubClients() as $client ) {
248
				$view->itemBody .= $client->save();
249
			}
250
251
			$manager->saveItem( clone $view->item );
252
			$manager->commit();
253
254
			$action = $view->param( 'next' );
255
			$id = ( $action === 'create' ? $view->item->getParentId() : $view->item->getId() );
0 ignored issues
show
Bug introduced by
The method getParentId() does not exist on Aimeos\MShop\Common\Item\Iface. It seems like you code against a sub-type of Aimeos\MShop\Common\Item\Iface such as Aimeos\MShop\Locale\Item\Site\Iface or Aimeos\MShop\Order\Item\Status\Iface or Aimeos\MShop\Common\Item\Lists\Iface or Aimeos\MShop\Order\Item\...Service\Attribute\Iface or Aimeos\MShop\Supplier\Item\Address\Iface or Aimeos\MShop\Common\Item\Property\Iface or Aimeos\MShop\Catalog\Item\Iface or Aimeos\MShop\Order\Item\...Product\Attribute\Iface or Aimeos\MShop\Coupon\Item\Code\Iface or Aimeos\MShop\Common\Item\Property\Standard or Aimeos\MShop\Catalog\Item\Standard or Aimeos\MShop\Locale\Item\Site\Standard or Aimeos\MShop\Common\Item\Lists\Standard or Aimeos\MShop\Coupon\Item\Code\Standard or Aimeos\MShop\Order\Item\...vice\Attribute\Standard or Aimeos\MShop\Order\Item\...duct\Attribute\Standard or Aimeos\MShop\Common\Item\Address\Standard or Aimeos\MShop\Order\Item\Status\Standard or Aimeos\MShop\Common\Item\Lists\Iface or Aimeos\MShop\Common\Item\Tree\Iface or Aimeos\MShop\Catalog\Item\Iface or Aimeos\MShop\Customer\Item\Address\Iface or Aimeos\MShop\Common\Item\Address\Standard or Aimeos\MShop\Supplier\Item\Address\Iface or Aimeos\MShop\Common\Item\Address\Standard. ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-call  annotation

255
			$id = ( $action === 'create' ? $view->item->/** @scrutinizer ignore-call */ getParentId() : $view->item->getId() );
Loading history...
256
257
			$this->nextAction( $view, $action, 'catalog', $id, 'save' );
258
			return;
259
		}
260
		catch( \Aimeos\Admin\JQAdm\Exception $e )
261
		{
262
			// fall through to create
263
		}
264
		catch( \Aimeos\MShop\Exception $e )
265
		{
266
			$error = array( 'catalog-item' => $context->getI18n()->dt( 'mshop', $e->getMessage() ) );
267
			$view->errors = $view->get( 'errors', [] ) + $error;
268
			$this->logException( $e );
269
		}
270
		catch( \Exception $e )
271
		{
272
			$error = array( 'catalog-item' => $e->getMessage() . ', ' . $e->getFile() . ':' . $e->getLine() );
273
			$view->errors = $view->get( 'errors', [] ) + $error;
274
			$this->logException( $e );
275
		}
276
277
		$manager->rollback();
278
279
		return $this->create();
280
	}
281
282
283
	/**
284
	 * Returns the catalog root node
285
	 *
286
	 * @return string HTML output
287
	 */
288
	public function search()
289
	{
290
		$view = $this->getView();
291
		$context = $this->getContext();
292
293
		try
294
		{
295
			$view->item = \Aimeos\MShop::create( $context, 'catalog' )->createItem();
296
			$view->itemRootId = $this->getRootId();
297
			$view->itemBody = '';
298
299
			foreach( $this->getSubClients() as $client ) {
300
				$view->itemBody .= $client->search();
301
			}
302
		}
303
		catch( \Aimeos\MShop\Exception $e )
304
		{
305
			$error = array( 'catalog-item' => $context->getI18n()->dt( 'mshop', $e->getMessage() ) );
306
			$view->errors = $view->get( 'errors', [] ) + $error;
307
			$this->logException( $e );
308
		}
309
		catch( \Exception $e )
310
		{
311
			$error = array( 'catalog-item' => $e->getMessage() . ', ' . $e->getFile() . ':' . $e->getLine() );
312
			$view->errors = $view->get( 'errors', [] ) + $error;
313
			$this->logException( $e );
314
		}
315
316
		return $this->render( $view );
317
	}
318
319
320
	/**
321
	 * Returns the sub-client given by its name.
322
	 *
323
	 * @param string $type Name of the client type
324
	 * @param string|null $name Name of the sub-client (Default if null)
325
	 * @return \Aimeos\Admin\JQAdm\Iface Sub-client object
326
	 */
327
	public function getSubClient( $type, $name = null )
328
	{
329
		/** admin/jqadm/catalog/decorators/excludes
330
		 * Excludes decorators added by the "common" option from the catalog JQAdm client
331
		 *
332
		 * Decorators extend the functionality of a class by adding new aspects
333
		 * (e.g. log what is currently done), executing the methods of the underlying
334
		 * class only in certain conditions (e.g. only for logged in users) or
335
		 * modify what is returned to the caller.
336
		 *
337
		 * This option allows you to remove a decorator added via
338
		 * "client/jqadm/common/decorators/default" before they are wrapped
339
		 * around the JQAdm client.
340
		 *
341
		 *  admin/jqadm/catalog/decorators/excludes = array( 'decorator1' )
342
		 *
343
		 * This would remove the decorator named "decorator1" from the list of
344
		 * common decorators ("\Aimeos\Admin\JQAdm\Common\Decorator\*") added via
345
		 * "client/jqadm/common/decorators/default" to the JQAdm client.
346
		 *
347
		 * @param array List of decorator names
348
		 * @since 2016.01
349
		 * @category Developer
350
		 * @see admin/jqadm/common/decorators/default
351
		 * @see admin/jqadm/catalog/decorators/global
352
		 * @see admin/jqadm/catalog/decorators/local
353
		 */
354
355
		/** admin/jqadm/catalog/decorators/global
356
		 * Adds a list of globally available decorators only to the catalog JQAdm client
357
		 *
358
		 * Decorators extend the functionality of a class by adding new aspects
359
		 * (e.g. log what is currently done), executing the methods of the underlying
360
		 * class only in certain conditions (e.g. only for logged in users) or
361
		 * modify what is returned to the caller.
362
		 *
363
		 * This option allows you to wrap global decorators
364
		 * ("\Aimeos\Admin\JQAdm\Common\Decorator\*") around the JQAdm client.
365
		 *
366
		 *  admin/jqadm/catalog/decorators/global = array( 'decorator1' )
367
		 *
368
		 * This would add the decorator named "decorator1" defined by
369
		 * "\Aimeos\Admin\JQAdm\Common\Decorator\Decorator1" only to the JQAdm client.
370
		 *
371
		 * @param array List of decorator names
372
		 * @since 2016.01
373
		 * @category Developer
374
		 * @see admin/jqadm/common/decorators/default
375
		 * @see admin/jqadm/catalog/decorators/excludes
376
		 * @see admin/jqadm/catalog/decorators/local
377
		 */
378
379
		/** admin/jqadm/catalog/decorators/local
380
		 * Adds a list of local decorators only to the catalog JQAdm client
381
		 *
382
		 * Decorators extend the functionality of a class by adding new aspects
383
		 * (e.g. log what is currently done), executing the methods of the underlying
384
		 * class only in certain conditions (e.g. only for logged in users) or
385
		 * modify what is returned to the caller.
386
		 *
387
		 * This option allows you to wrap local decorators
388
		 * ("\Aimeos\Admin\JQAdm\Catalog\Decorator\*") around the JQAdm client.
389
		 *
390
		 *  admin/jqadm/catalog/decorators/local = array( 'decorator2' )
391
		 *
392
		 * This would add the decorator named "decorator2" defined by
393
		 * "\Aimeos\Admin\JQAdm\Catalog\Decorator\Decorator2" only to the JQAdm client.
394
		 *
395
		 * @param array List of decorator names
396
		 * @since 2016.01
397
		 * @category Developer
398
		 * @see admin/jqadm/common/decorators/default
399
		 * @see admin/jqadm/catalog/decorators/excludes
400
		 * @see admin/jqadm/catalog/decorators/global
401
		 */
402
		return $this->createSubClient( 'catalog/' . $type, $name );
403
	}
404
405
406
	/**
407
	 * Returns the domain names whose items should be fetched too
408
	 *
409
	 * @return string[] List of domain names
410
	 */
411
	protected function getDomains()
412
	{
413
		/** admin/jqadm/catalog/domains
414
		 * List of domain items that should be fetched along with the catalog
415
		 *
416
		 * If you need to display additional content, you can configure your own
417
		 * list of domains (attribute, media, price, catalog, text, etc. are
418
		 * domains) whose items are fetched from the storage.
419
		 *
420
		 * @param array List of domain names
421
		 * @since 2016.01
422
		 * @category Developer
423
		 */
424
		$domains = array( 'media', 'text' );
425
426
		return $this->getContext()->getConfig()->get( 'admin/jqadm/catalog/domains', $domains );
427
	}
428
429
430
	/**
431
	 * Returns the IDs of the root category
432
	 *
433
	 * @return string|null ID of the root category
434
	 */
435
	protected function getRootId()
436
	{
437
		$manager = \Aimeos\MShop::create( $this->getContext(), 'catalog' );
438
439
		try {
440
			return $manager->getTree( null, [], \Aimeos\MW\Tree\Manager\Base::LEVEL_ONE )->getId();
441
		} catch( \Exception $e ) {
442
			return null;
443
		}
444
	}
445
446
447
	/**
448
	 * Returns the list of sub-client names configured for the client.
449
	 *
450
	 * @return array List of JQAdm client names
451
	 */
452
	protected function getSubClientNames()
453
	{
454
		/** admin/jqadm/catalog/standard/subparts
455
		 * List of JQAdm sub-clients rendered within the catalog section
456
		 *
457
		 * The output of the frontend is composed of the code generated by the JQAdm
458
		 * clients. Each JQAdm client can consist of serveral (or none) sub-clients
459
		 * that are responsible for rendering certain sub-parts of the output. The
460
		 * sub-clients can contain JQAdm clients themselves and therefore a
461
		 * hierarchical tree of JQAdm clients is composed. Each JQAdm client creates
462
		 * the output that is placed inside the container of its parent.
463
		 *
464
		 * At first, always the JQAdm code generated by the parent is printed, then
465
		 * the JQAdm code of its sub-clients. The order of the JQAdm sub-clients
466
		 * determines the order of the output of these sub-clients inside the parent
467
		 * container. If the configured list of clients is
468
		 *
469
		 *  array( "subclient1", "subclient2" )
470
		 *
471
		 * you can easily change the order of the output by reordering the subparts:
472
		 *
473
		 *  admin/jqadm/<clients>/subparts = array( "subclient1", "subclient2" )
474
		 *
475
		 * You can also remove one or more parts if they shouldn't be rendered:
476
		 *
477
		 *  admin/jqadm/<clients>/subparts = array( "subclient1" )
478
		 *
479
		 * As the clients only generates structural JQAdm, the layout defined via CSS
480
		 * should support adding, removing or reordering content by a fluid like
481
		 * design.
482
		 *
483
		 * @param array List of sub-client names
484
		 * @since 2016.01
485
		 * @category Developer
486
		 */
487
		return $this->getContext()->getConfig()->get( 'admin/jqadm/catalog/standard/subparts', [] );
488
	}
489
490
491
	/**
492
	 * Creates new and updates existing items using the data array
493
	 *
494
	 * @param array $data Data array
495
	 * @return \Aimeos\MShop\Catalog\Item\Iface New catalog item object
496
	 */
497
	protected function fromArray( array $data )
498
	{
499
		$conf = [];
500
501
		if( isset( $data['config']['key'] ) )
502
		{
503
			foreach( (array) $data['config']['key'] as $idx => $key )
504
			{
505
				if( trim( $key ) !== '' && isset( $data['config']['val'][$idx] ) ) {
506
					$conf[$key] = $data['config']['val'][$idx];
507
				}
508
			}
509
		}
510
511
		$manager = \Aimeos\MShop::create( $this->getContext(), 'catalog' );
512
513
		if( isset( $data['catalog.id'] ) && $data['catalog.id'] != '' ) {
514
			$item = $manager->getItem( $data['catalog.id'], $this->getDomains() );
515
		} else {
516
			$item = $manager->createItem();
517
		}
518
519
		$item->fromArray( $data, true );
520
		$item->setConfig( $conf );
0 ignored issues
show
Bug introduced by
The method setConfig() does not exist on Aimeos\MShop\Common\Item\Iface. It seems like you code against a sub-type of Aimeos\MShop\Common\Item\Iface such as Aimeos\MShop\Product\Item\Iface or Aimeos\MShop\Service\Item\Iface or Aimeos\MShop\Locale\Item\Site\Iface or Aimeos\MShop\Coupon\Item\Iface or Aimeos\MShop\Common\Item\Lists\Iface or Aimeos\MShop\Catalog\Item\Iface or Aimeos\MShop\Plugin\Item\Iface or Aimeos\MShop\Catalog\Item\Standard or Aimeos\MShop\Plugin\Item\Standard or Aimeos\MShop\Locale\Item\Site\Standard or Aimeos\MShop\Common\Item\Lists\Standard or Aimeos\MShop\Service\Item\Standard or Aimeos\MShop\Coupon\Item\Standard or Aimeos\MShop\Product\Item\Standard or Aimeos\MShop\Product\Item\Iface or Aimeos\MShop\Service\Item\Iface or Aimeos\MShop\Coupon\Item\Iface or Aimeos\MShop\Common\Item\Lists\Iface or Aimeos\MShop\Plugin\Item\Iface or Aimeos\MShop\Locale\Item\Site\Iface or Aimeos\MShop\Catalog\Item\Iface or Aimeos\MShop\Product\Item\Iface or Aimeos\MShop\Service\Item\Iface or Aimeos\MShop\Catalog\Item\Iface or Aimeos\MShop\Product\Item\Iface. ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-call  annotation

520
		$item->/** @scrutinizer ignore-call */ 
521
         setConfig( $conf );
Loading history...
Bug introduced by
The method setConfig() does not exist on Aimeos\MShop\Attribute\Item\Iface. ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-call  annotation

520
		$item->/** @scrutinizer ignore-call */ 
521
         setConfig( $conf );

This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces.

This is most likely a typographical error or the method has been renamed.

Loading history...
521
522
		if( $item->getId() == null ) {
0 ignored issues
show
Bug introduced by
It seems like you are loosely comparing $item->getId() of type null|string against null; this is ambiguous if the string can be empty. Consider using a strict comparison === instead.
Loading history...
523
			return $manager->insertItem( $item, $data['catalog.parentid'] ?: null );
524
		}
525
526
		return $item;
527
	}
528
529
530
	/**
531
	 * Constructs the data array for the view from the given item
532
	 *
533
	 * @param \Aimeos\MShop\Catalog\Item\Iface $item Catalog item object
534
	 * @return string[] Multi-dimensional associative list of item data
535
	 */
536
	protected function toArray( \Aimeos\MShop\Catalog\Item\Iface $item, $copy = false )
537
	{
538
		$data = $item->toArray( true );
539
		$data['config'] = [];
540
541
		if( $copy === true )
542
		{
543
			$data['catalog.id'] = '';
544
			$data['catalog.siteid'] = $item->getSiteId();
545
			$data['catalog.code'] = $data['catalog.code'] . '_copy';
546
		}
547
548
		foreach( $item->getConfig() as $key => $value )
549
		{
550
			$data['config']['key'][] = $key;
551
			$data['config']['val'][] = $value;
552
		}
553
554
		return $data;
555
	}
556
557
558
	/**
559
	 * Returns the rendered template including the view data
560
	 *
561
	 * @param \Aimeos\MW\View\Iface $view View object with data assigned
562
	 * @return string HTML output
563
	 */
564
	protected function render( \Aimeos\MW\View\Iface $view )
565
	{
566
		/** admin/jqadm/catalog/template-item
567
		 * Relative path to the HTML body template for the catalog item.
568
		 *
569
		 * The template file contains the HTML code and processing instructions
570
		 * to generate the result shown in the body of the frontend. The
571
		 * configuration string is the path to the template file relative
572
		 * to the templates directory (usually in admin/jqadm/templates).
573
		 *
574
		 * You can overwrite the template file configuration in extensions and
575
		 * provide alternative templates. These alternative templates should be
576
		 * named like the default one but with the string "default" replaced by
577
		 * an unique name. You may use the name of your project for this. If
578
		 * you've implemented an alternative client class as well, "default"
579
		 * should be replaced by the name of the new class.
580
		 *
581
		 * @param string Relative path to the template creating the HTML code
582
		 * @since 2016.04
583
		 * @category Developer
584
		 */
585
		$tplconf = 'admin/jqadm/catalog/template-item';
586
		$default = 'catalog/item-standard';
587
588
		return $view->render( $view->config( $tplconf, $default ) );
589
	}
590
}
591