本文整理汇总了PHP中xPDOSimpleObject::toArray方法的典型用法代码示例。如果您正苦于以下问题:PHP xPDOSimpleObject::toArray方法的具体用法?PHP xPDOSimpleObject::toArray怎么用?PHP xPDOSimpleObject::toArray使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类xPDOSimpleObject
的用法示例。
在下文中一共展示了xPDOSimpleObject::toArray方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: toArray
public function toArray($keyPrefix = '', $rawValues = false, $excludeLazy = false, $includeRelated = false)
{
$array = parent::toArray($keyPrefix, $rawValues, $excludeLazy);
if (!empty($this->xpdo->lexicon) && $this->xpdo->lexicon instanceof modLexicon) {
if ($this->get('lexicon') != 'core:dashboards') {
$this->xpdo->lexicon->load($this->get('lexicon'));
}
$array['name_trans'] = $this->xpdo->lexicon->exists($this->get('name')) ? $this->xpdo->lexicon($this->get('name')) : $this->get('name');
$array['description_trans'] = $this->xpdo->lexicon->exists($this->get('description')) ? $this->xpdo->lexicon($this->get('description')) : $this->get('description');
}
return $array;
}
示例2: toArray
/**
* {inheritdoc}
* @param string $keyPrefix
* @param bool $rawValues
* @param bool $excludeLazy
* @param bool $includeRelated
* @return array
*/
public function toArray($keyPrefix = '', $rawValues = false, $excludeLazy = false, $includeRelated = false)
{
$arr = parent::toArray($keyPrefix, $rawValues, $excludeLazy, $includeRelated);
// figure out the icon
$icon = $this->getIcon();
if (!empty($icon) && is_array($icon)) {
switch ($icon['type']) {
case 'custom':
$arr['iconcls'] = '';
$arr['iconpath'] = $icon['value'];
break;
case 'preset':
default:
$arr['iconcls'] = $icon['value'];
$arr['iconpath'] = '';
break;
}
}
return $arr;
}
示例3: toArray
/**
* Override toArray to provide more values
*
* @param string $keyPrefix
* @param bool $rawValues
* @param bool $excludeLazy
* @param bool $includeRelated
* @return array
*/
public function toArray($keyPrefix = '', $rawValues = false, $excludeLazy = false, $includeRelated = false)
{
$values = parent::toArray($keyPrefix, $rawValues, $excludeLazy);
if ($this->xpdo->context->key != 'mgr' && $this->xpdo->discuss) {
$values['url'] = $this->getUrl();
}
return $values;
}
示例4: toArray
/**
* Override toArray to provide more values
*
* @param string $keyPrefix
* @param bool $rawValues
* @param bool $excludeLazy
* @param bool $includeRelated
* @return array
*/
public function toArray($keyPrefix = '', $rawValues = false, $excludeLazy = false, $includeRelated = false)
{
$values = parent::toArray($keyPrefix, $rawValues, $excludeLazy, $includeRelated);
$values[$keyPrefix . 'age'] = $this->get('age');
$values[$keyPrefix . 'gender_formatted'] = $this->get('gender_formatted');
$values[$keyPrefix . 'avatarUrl'] = $this->getAvatarUrl();
$values[$keyPrefix . 'isSelf'] = $this->xpdo->user->get('id') == $this->get('user');
$values[$keyPrefix . 'canEdit'] = $values[$keyPrefix . 'isSelf'];
$values[$keyPrefix . 'canAccount'] = $values[$keyPrefix . 'isSelf'];
$values[$keyPrefix . 'canMerge'] = $values[$keyPrefix . 'isSelf'];
$values[$keyPrefix . 'name'] = $this->get('name');
$values[$keyPrefix . 'posts_formatted'] = $this->get('posts_formatted');
return $values;
}
示例5: toArray
/**
* @param string $keyPrefix
* @param bool $rawValues
* @param bool $excludeLazy
* @param bool $includeRelated
* @return array
*/
public function toArray($keyPrefix = '', $rawValues = false, $excludeLazy = false, $includeRelated = false)
{
$array = parent::toArray($keyPrefix, $rawValues, $excludeLazy);
foreach ($array as $k => &$v) {
if ($k == 'title') {
$v = strip_tags($v, '<span>');
$v = preg_replace('@\\[\\[(.[^\\[\\[]*?)\\]\\]@si', '', $v);
$v = html_entity_decode($v, ENT_COMPAT, 'UTF-8');
}
}
reset($array);
return $array;
}
示例6: toArray
/**
* Always ensure that the title strips any HTML/MODX tags
* @param string $keyPrefix
* @param bool $rawValues
* @param bool $excludeLazy
* @param bool $includeRelated
* @return array
*/
public function toArray($keyPrefix = '', $rawValues = false, $excludeLazy = false, $includeRelated = false)
{
$array = parent::toArray($keyPrefix, $rawValues, $excludeLazy);
foreach ($array as $k => &$v) {
if ($k == 'title') {
$v = $this->xpdo->discuss->stripAllTags($v);
}
}
reset($array);
return $array;
}
示例7: toArray
public function toArray($keyPrefix = '', $rawValues = false, $excludeLazy = false, $includeRelated = false)
{
$array = parent::toArray($keyPrefix, $rawValues, $excludeLazy, $includeRelated);
$array['badge'] = $this->getBadge();
return $array;
}