18 protected array $temp_metadata = [];
39 return array_map(
function($values) {
40 return count($values) > 1 ? $values : $values[0];
41 }, $this->temp_metadata);
53 $metadata_values = [];
55 $metadata_values[$md->name][] = $md->value;
58 return array_map(
function($values) {
59 return count($values) > 1 ? $values : $values[0];
86 $value = array_values(array_filter(
$value,
function($var) {
88 return !is_null($var) && $var !==
'';
98 if (empty($this->guid)) {
106 $md_cache_enabled = $md_cache->isEnabled();
107 $md_cache->disable();
108 $restore_md_cache =
function() use ($md_cache, $md_cache_enabled) {
109 if ($md_cache_enabled) {
118 if ((is_array($existing_ids) || count(
$value) > 1) && isset($existing_ids)) {
134 foreach (
$value as $value_tmp) {
140 if (!empty($value_type)) {
169 unset($this->temp_metadata[
$name]);
178 if (!isset($this->temp_metadata[
$name])) {
179 $this->temp_metadata[
$name] = [];
182 $this->temp_metadata[
$name] = array_merge($this->temp_metadata[
$name],
$value);
202 if (isset($this->temp_metadata[
$name])) {
203 unset($this->temp_metadata[
$name]);
206 $this->temp_metadata = [];
213 'guid' => $this->guid,
215 'metadata_name' =>
$name,
$guid
Reset an ElggUpgrade.
if(! $user||! $user->canDelete()) $name
_elgg_services()
Get the global service provider.
elgg_extract($key, $array, $default=null, bool $strict=true)
Checks for $array[$key] and returns its value if it exists, else returns $default.
setMetadata(string $name, mixed $value, string $value_type='', bool $multiple=false)
Set metadata on this entity.
getMetadata(string $name)
Return the value of a piece of metadata.
trait Metadata
Bundle all metadata related functions for an \ElggEntity.
getAllMetadata()
Get all entity metadata.
deleteMetadata(?string $name=null)
Deletes all metadata on this object (metadata.entity_guid = $this->guid).
setTempMetadata(string $name, mixed $value, bool $multiple=false)
Set temp metadata on this entity.
if(parse_url(elgg_get_site_url(), PHP_URL_PATH) !=='/') if(file_exists(elgg_get_root_path() . 'robots.txt'))
Set robots.txt.