Skip to content

Commit

Permalink
Allow to extend the list of text types in subclasses
Browse files Browse the repository at this point in the history
  • Loading branch information
aimeos committed Nov 1, 2016
1 parent b7112ed commit d3a3800
Showing 1 changed file with 14 additions and 3 deletions.
17 changes: 14 additions & 3 deletions admin/jqadm/src/Admin/JQAdm/Product/Text/Standard.php
Expand Up @@ -326,6 +326,17 @@ protected function getTypeId( $type )
}


/**
* Returns the text types that are managed by this subpart
*
* @return array List of text type codes
*/
protected function getTypes()
{
return $this->typelist;
}


/**
* Returns the mapped input parameter or the existing items as expected by the template
*
Expand Down Expand Up @@ -353,7 +364,7 @@ protected function setData( \Aimeos\MW\View\Iface $view )
$type = $refItem->getType();
$langid = $refItem->getLanguageId();

if( in_array( $type, $this->typelist ) )
if( in_array( $type, $this->getTypes() ) )
{
$data['langid'][$langid] = $langid;
$data[$type]['listid'][$langid] = $listItem->getId();
Expand Down Expand Up @@ -404,7 +415,7 @@ protected function updateItems( \Aimeos\MW\View\Iface $view )

foreach( $langIds as $idx => $langid )
{
foreach( $this->typelist as $type )
foreach( $this->getTypes() as $type )
{
if( ( $content = trim( $view->param( 'text/' . $type . '/content/' . $idx ) ) ) === '' ) {
continue;
Expand Down Expand Up @@ -446,7 +457,7 @@ protected function updateItems( \Aimeos\MW\View\Iface $view )

foreach( $listItems as $id => $listItem )
{
if( in_array( $listItem->getRefItem()->getType(), $this->typelist ) ) {
if( in_array( $listItem->getRefItem()->getType(), $this->getTypes() ) ) {
$allListIds[] = $id;
}
}
Expand Down

0 comments on commit d3a3800

Please sign in to comment.