Skip to content

Commit

Permalink
added method for category name associative array
Browse files Browse the repository at this point in the history
  • Loading branch information
Luke Snowden authored and Luke Snowden committed Jan 16, 2018
1 parent 5314858 commit 16e0353
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions src/LukeSnowden/GoogleShoppingFeed/Feed.php
Original file line number Diff line number Diff line change
Expand Up @@ -265,6 +265,21 @@ public function categoriesAsSelect($selected = '', $languageISO639 = 'gb')
return $select;
}

/**
* @param string $languageISO639
* @return array
*/
public function categoriesAsNameAssociativeArray( $languageISO639 = 'gb' )
{
$categories = $this->categories($languageISO639);
unset($categories[0]);
$return = [];
foreach( $categories as $key => $value ) {
$return[$value] = $value;
}
return $return;
}

/**
* Generate RSS feed
* @param bool $output
Expand Down

0 comments on commit 16e0353

Please sign in to comment.