本文整理汇总了PHP中Includes\Utils\ArrayManager::searchInObjectsArray方法的典型用法代码示例。如果您正苦于以下问题:PHP ArrayManager::searchInObjectsArray方法的具体用法?PHP ArrayManager::searchInObjectsArray怎么用?PHP ArrayManager::searchInObjectsArray使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Includes\Utils\ArrayManager
的用法示例。
在下文中一共展示了ArrayManager::searchInObjectsArray方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getHardTranslation
/**
* Search for translation
*
* @param string $code Language code OPTIONAL
*
* @return \XLite\Model\Base\Translation
*/
public function getHardTranslation($code = null)
{
return \Includes\Utils\ArrayManager::searchInObjectsArray($this->getTranslations()->toArray(), 'getCode', $this->getTranslationCode($code));
}
示例2: checkForActiveLanguage
/**
* Check if the language code is in the active languages list
* If customer language is not used right now, the default customer language code is used
*
* @param string $languageCode Language code
*
* @return string
*/
protected function checkForActiveLanguage($languageCode)
{
$result = $languageCode;
$langs = \XLite\Core\Database::getRepo('XLite\\Model\\Language')->findActiveLanguages();
if (!empty($langs)) {
$resultModel = \Includes\Utils\ArrayManager::searchInObjectsArray($langs, 'getCode', $result);
if (null === $resultModel) {
$result = \XLite\Core\Config::getInstance()->General->default_language;
}
}
return $result;
}
示例3: defineCurrentLanguage
/**
* Define current language
*
* @return string Language code
*/
protected function defineCurrentLanguage()
{
$languages = \XLite\Core\Database::getRepo('XLite\\Model\\Language')->findActiveLanguages();
if (!\XLite::isAdminZone() && !empty($languages)) {
$language = isset(\XLite\Core\Config::getInstance()->General) ? \XLite\Core\Config::getInstance()->General->default_language : 'en';
$result = \Includes\Utils\ArrayManager::searchInObjectsArray($languages, 'getCode', $language);
}
return isset($result) ? $result->getCode() : static::getDefaultLanguage();
}