Constructs the data array for the view from the given item

@param \Aimeos\MShop\Locale\Item\Iface $item Locale item object
@return string[] Multi-dimensional associative list of item data
170846
protected function toArray( \Aimeos\MShop\Locale\Item\Currency\Iface $item, $copy = false )
	{
		$data = $item->toArray( true );

		if( $copy === true )
		{
			$data['locale.currency.id'] = '';
			$data['locale.currency.code'] = '';
		}

		return $data;
	}
1187790
protected function getProductListPage( \Aimeos\MW\View\Iface $view )
	{
		$page = (int) $view->param( 'fav_page', 1 );
		return ( $page < 1 ? 1 : $page );
	}
1173332
protected function prepareItem($item)
    {
        if (!isset($item["type"])) {
            return $item;
        }

        if (isset($item["children"])) {
            $item["children"] = $this->prepareItems($item["children"]);
        }

        switch ($item['type']) {
            case 'select':
                if (isset($item['sql'])) {
                    $connectionName = isset($item['connection']) ? $item['connection'] : 'default';
                    $sql            = $item['sql'];
                    $options        = isset($item["options"]) ? $item["options"] : array();

                    unset($item['sql']);
                    unset($item['connection']);
                    /** @var Connection $connection */
                    $connection = $this->container->get("doctrine.dbal.{$connectionName}_connection");
                    $all        = $connection->fetchAll($sql);
                    foreach ($all as $option) {
                        $options[] = array(reset($option), end($option));
                    }
                    $item["options"] = $options;
                }

                if (isset($item['service'])) {
                    $serviceInfo = $item['service'];
                    $serviceName = isset($serviceInfo['serviceName']) ? $serviceInfo['serviceName'] : 'default';
                    $method      = isset($serviceInfo['method']) ? $serviceInfo['method'] : 'get';
                    $args        = isset($serviceInfo['args']) ? $item['args'] : '';
                    $service     = $this->container->get($serviceName);
                    $options     = $service->$method($args);

                    $item['options'] = $options;
                }

                if (isset($item['dataStore'])) {
                    $dataStoreInfo = $item['dataStore'];
                    $dataStore     = $this->container->get('data.source')->get($dataStoreInfo["id"]);
                    $options       = array();
                    foreach ($dataStore->search() as $dataItem) {
                        $options[ $dataItem->getId() ] = $dataItem->getAttribute($dataStoreInfo["text"]);
                    }
                    if (isset($item['dataStore']['popupItems'])) {
                        $item['dataStore']['popupItems'] = $this->prepareItems($item['dataStore']['popupItems']);
                    }
                    $item['options'] = $options;
                }
                break;
        }
        return $item;
    }
1138016
protected function getStableOrientationsInEmptyBox(Item $item): array
    {
        $orientationsInEmptyBox = $this->getPossibleOrientationsInEmptyBox($item);

        return array_filter(
            $orientationsInEmptyBox,
            function (OrientatedItem $orientation) {
                return $orientation->isStable();
            }
        );
    }
171666
protected function createNodeArray( \Aimeos\MShop\Catalog\Item\Iface $node )
	{
		$result = $node->toArray( true );

		foreach( $node->getChildren() as $child ) {
			$result['children'][] = $this->createNodeArray( $child );
		}

		return (object) $result;
	}
730289
public static function getLocale( \Aimeos\MShop\Context\Item\Iface $context, \TYPO3\CMS\Extbase\Mvc\RequestInterface $request = null )
	{
		if( isset( $GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['aimeos']['aimeos_locale_frontend'] ) ) {
			if( ( $name = $GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['aimeos']['aimeos_locale_frontend'] ) instanceof \Closure ) {
				return $name( $context, $request );
			}
		}

		$name = 'Aimeos\Aimeos\Base\Locale';

		if( isset( $GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['aimeos']['aimeos_locale'] ) ) {
			$name = $GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['aimeos']['aimeos_locale'];
		}

		return $name::get( $context, $request );
	}
104749
protected function fromArray( \Aimeos\MShop\Product\Item\Iface $item, array $data )
	{
		$manager = \Aimeos\MShop::create( $this->getContext(), 'catalog/lists' );
		$listIds = (array) $this->getValue( $data, 'catalog.lists.id', [] );
		$listItems = $map = $this->getListItems( $item->getId() );


		foreach( $listIds as $idx => $listid )
		{
			if( isset( $map[$listid] ) ) {
				unset( $map[$listid] );
			}
		}

		$manager->deleteItems( array_keys( $map ) );


		foreach( $listIds as $idx => $listid )
		{
			if( isset( $listItems[$listid] ) ) {
				$litem = $listItems[$listid];
			} else {
				$litem = $manager->createItem();
			}

			$litem->setDomain( 'product' );
			$litem->setRefId( $item->getId() );
			$litem->setParentId( $this->getValue( $data, 'catalog.id/' . $idx ) );
			$litem->setType( $this->getValue( $data, 'catalog.lists.type/' . $idx ) );

			$manager->saveItem( $litem, false );
		}
	}
912532
public function set( \Aimeos\MShop\Common\Item\Iface $item )
	{
		$code = $item->getCode();

		if( !isset( $this->attributes[$code] ) || !is_array( $this->attributes[$code] ) ) {
			$this->attributes[$code] = [];
		}

		$this->attributes[$code][$item->getType()] = $item;
	}
275481
public function parse(array $item): array
    {
        if (\count($item['fieldLayout']) > 1) {
            $errors = [
                'fieldLayout' => [
                    Architect::t('Field layout can only have 1 tab.')

                ]
            ];
            return [null, $errors];
        }

        $tagGroup = new TagGroup([
            'name' => $item['name'],
            'handle' => $item['handle'],
        ]);

        $fieldLayout = new FieldLayout();
        $fieldLayout->type = Tag::class;

        return [$tagGroup, null];
    }
1357636
public function parse(array $item): array
    {
        $siteUid = null;
        try {
            $site = Craft::$app->sites->getSiteByHandle($item['siteId']);
            $siteUid = $site->uid;
        } catch (\Exception $e) {}
        return [
            [ $item['uriParts'], $item['template'], $siteUid ],
            false
        ];
    }
1042240
public function parse(array $item): array
    {
        $item['groupId'] = $this->getGroupByName($item['group'])->id;
        unset($item['group']);
        $site = new Site($item);

        return [$site, null];
    }
260882
public function getContainerValues(&$item)
    {
        if (false === is_object($item) && false === is_array($item)) {
            $item = $this->getContainerServices($this->getContainerParameters($item));
        }

        return $item;
    }
1239738
public function parse(array $item): array
    {
        $siteSettings = [];
        foreach ($item['siteSettings'] as $settingKey => $settings) {
            $siteId = isset($settings['siteId']) ? Craft::$app->sites->getSiteByHandle($settings['siteId'])->id : Craft::$app->sites->getPrimarySite()->id;
            unset($settings['siteId']);
            $siteSettings[$siteId] = new CategoryGroup_SiteSettings(array_merge($settings, [
                'siteId' => $siteId,
                'hasUrls' => !empty($settings['uriFormat']),
            ]));
        }
        $categoryGroup = new CategoryGroup([
            'name' => $item['name'],
            'handle' => $item['handle'],
            'maxLevels' => $item['maxLevels'],
        ]);

        $categoryGroup->setSiteSettings($siteSettings);

        return [$categoryGroup, null];
    }
136182
public function importItem(Item $item)
    {
        foreach ($this->data as $templateData) {
            foreach ($item->getData() as $itemData) {
                if ($itemData->getName() === $templateData->getName()) {
                    $templateData->setName($itemData->getName());
                    $templateData->setValue($itemData->getValue());
                    $templateData->setPrompt($itemData->getPrompt());
                }
            }
        }

        return $this;
    }
361306
protected function checkLocale( \Aimeos\MShop\Locale\Item\Iface $locale, $type )
	{
		$errors = [];
		$context = $this->getContext();
		$session = $context->getSession();

		$localeStr = $session->get( 'aimeos/basket/locale' );
		$localeKey = $locale->getSite()->getCode() . '|' . $locale->getLanguageId() . '|' . $locale->getCurrencyId();

		if( $localeStr !== null && $localeStr !== $localeKey )
		{
			$locParts = explode( '|', $localeStr );
			$locSite = ( isset( $locParts[0] ) ? $locParts[0] : '' );
			$locLanguage = ( isset( $locParts[1] ) ? $locParts[1] : '' );
			$locCurrency = ( isset( $locParts[2] ) ? $locParts[2] : '' );

			$localeManager = \Aimeos\MShop::create( $context, 'locale' );
			$locale = $localeManager->bootstrap( $locSite, $locLanguage, $locCurrency, false );

			$context = clone $context;
			$context->setLocale( $locale );

			$manager = \Aimeos\MShop\Order\Manager\Factory::create( $context )->getSubManager( 'base' );
			$basket = $manager->getSession( $type )->off();

			$this->copyAddresses( $basket, $errors, $localeKey );
			$this->copyServices( $basket, $errors );
			$this->copyProducts( $basket, $errors, $localeKey );
			$this->copyCoupons( $basket, $errors, $localeKey );

			$manager->setSession( $basket, $type );
		}

		$session->set( 'aimeos/basket/locale', $localeKey );
	}
239517
protected function fromArray( \Aimeos\MShop\Product\Item\Iface $item, array $data )
	{
		$context = $this->getContext();

		$attrManager = \Aimeos\MShop::create( $context, 'attribute' );
		$listManager = \Aimeos\MShop::create( $context, 'product/lists' );
		$typeManager = \Aimeos\MShop::create( $context, 'product/lists/type' );

		$attrId = $attrManager->findItem( 'custom', [], 'product', 'price' )->getId();

		if( $this->getValue( $data, 'custom', 0 ) == 1 )
		{
			if( $item->getListItem( 'attribute', 'custom', $attrId, false ) === null )
			{
				$listItem = $listManager->createItem()->setType( 'custom' )->setRefId( $attrId );
				$item->addListItem( 'attribute', $listItem, $listItem->getRefItem() );
			}
		}
		else
		{
			if( ( $litem = $item->getListItem( 'attribute', 'custom', $attrId, false ) ) !== null ) {
				$item->deleteListItem( 'attribute', $litem );
			}
		}
	}
402974
protected function fromArray( \Aimeos\MShop\Attribute\Item\Iface $item, array $data )
	{
		$manager = \Aimeos\MShop::create( $this->getContext(), 'attribute/property' );

		$propItems = $item->getPropertyItems( null, false );

		foreach( $data as $entry )
		{
			if( isset( $propItems[$entry['attribute.property.id']] ) )
			{
				$propItem = $propItems[$entry['attribute.property.id']];
				unset( $propItems[$entry['attribute.property.id']] );
			}
			else
			{
				$propItem = $manager->createItem();
			}

			$propItem->fromArray( $entry, true );
			$item->addPropertyItem( $propItem );
		}

		$item->deletePropertyItems( $propItems );
	}