modResource.getProperty
Последнее обновление not available | История страницы | Улучшить эту страницу | Сообщить о проблеме
Support the team building MODX with a monthly donation.
The budget raised through OpenCollective is transparent, including payouts, and any contributor can apply to be paid for their work on MODX.
Backers
Budget
$194 per month—let's make that $500!
Learn moremodResource.getProperty¶
Читает одно значение из поля properties ресурса с пространством имён. Возвращает $default, если нет либо пространства имён, либо ключа. Отсутствующее свойство и свойство, явно установленное в null, различить нельзя.
Значение живёт на объекте до save(); записывайте его через setProperty().
Синтаксис¶
mixed getProperty ($key [, string $namespace = 'core' [, mixed $default = null]])
-
$key(string) имя свойства -
$namespace(string) пространство имён, которому принадлежит свойство, по умолчанию'core' -
$default(mixed) возвращаемое значение, если свойство не задано, по умолчаниюnull
Пример¶
$resource = $modx->getObject('modResource', array('id' => 5));
$color = $resource->getProperty('color', 'mycomponent', 'foobar');
Смотрите также¶
Support the team building MODX with a monthly donation.
The budget raised through OpenCollective is transparent, including payouts, and any contributor can apply to be paid for their work on MODX.
Backers
Budget
$194 per month—let's make that $500!
Learn more










