Elgg  Version master
ElggMetadata.php
Go to the documentation of this file.
1 <?php
2 
11 class ElggMetadata extends ElggExtender {
12 
16  protected function initializeAttributes() {
17  parent::initializeAttributes();
18 
19  $this->attributes['type'] = 'metadata';
20  $this->attributes['access_id '] = ACCESS_PUBLIC;
21  }
22 
28  public function __construct(?\stdClass $row = null) {
29  $this->initializeAttributes();
30 
31  if ($row) {
32  foreach ((array) $row as $key => $value) {
33  $this->$key = $value;
34  }
35  }
36  }
37 
45  public function canEdit(int $user_guid = 0): bool {
46  return elgg_has_access_to_entity($this->entity_guid, $user_guid);
47  }
48 
54  public function save(): bool {
55  if (!$this->id) {
56  return (bool) _elgg_services()->metadataTable->create($this);
57  }
58 
59  return _elgg_services()->metadataTable->update($this);
60  }
61 
67  public function delete(): bool {
68  return _elgg_services()->metadataTable->delete($this);
69  }
70 
74  public function getObjectFromID(int $id) {
76  }
77 }
$id
Generic annotation delete action.
Definition: delete.php:6
return[ 'admin/delete_admin_notices'=>['access'=> 'admin'], 'admin/menu/save'=>['access'=> 'admin'], 'admin/plugins/activate'=>['access'=> 'admin'], 'admin/plugins/activate_all'=>['access'=> 'admin'], 'admin/plugins/deactivate'=>['access'=> 'admin'], 'admin/plugins/deactivate_all'=>['access'=> 'admin'], 'admin/plugins/set_priority'=>['access'=> 'admin'], 'admin/security/security_txt'=>['access'=> 'admin'], 'admin/security/settings'=>['access'=> 'admin'], 'admin/security/regenerate_site_secret'=>['access'=> 'admin'], 'admin/site/cache/invalidate'=>['access'=> 'admin'], 'admin/site/flush_cache'=>['access'=> 'admin'], 'admin/site/icons'=>['access'=> 'admin'], 'admin/site/set_maintenance_mode'=>['access'=> 'admin'], 'admin/site/set_robots'=>['access'=> 'admin'], 'admin/site/theme'=>['access'=> 'admin'], 'admin/site/unlock_upgrade'=>['access'=> 'admin'], 'admin/site/settings'=>['access'=> 'admin'], 'admin/upgrade'=>['access'=> 'admin'], 'admin/upgrade/reset'=>['access'=> 'admin'], 'admin/user/ban'=>['access'=> 'admin'], 'admin/user/bulk/ban'=>['access'=> 'admin'], 'admin/user/bulk/delete'=>['access'=> 'admin'], 'admin/user/bulk/unban'=>['access'=> 'admin'], 'admin/user/bulk/validate'=>['access'=> 'admin'], 'admin/user/change_email'=>['access'=> 'admin'], 'admin/user/delete'=>['access'=> 'admin'], 'admin/user/login_as'=>['access'=> 'admin'], 'admin/user/logout_as'=>[], 'admin/user/makeadmin'=>['access'=> 'admin'], 'admin/user/resetpassword'=>['access'=> 'admin'], 'admin/user/removeadmin'=>['access'=> 'admin'], 'admin/user/unban'=>['access'=> 'admin'], 'admin/user/validate'=>['access'=> 'admin'], 'annotation/delete'=>[], 'avatar/upload'=>[], 'comment/save'=>[], 'diagnostics/download'=>['access'=> 'admin'], 'entity/chooserestoredestination'=>[], 'entity/delete'=>[], 'entity/mute'=>[], 'entity/restore'=>[], 'entity/subscribe'=>[], 'entity/trash'=>[], 'entity/unmute'=>[], 'entity/unsubscribe'=>[], 'login'=>['access'=> 'logged_out'], 'logout'=>[], 'notifications/mute'=>['access'=> 'public'], 'plugins/settings/remove'=>['access'=> 'admin'], 'plugins/settings/save'=>['access'=> 'admin'], 'plugins/usersettings/save'=>[], 'register'=>['access'=> 'logged_out', 'middleware'=>[\Elgg\Router\Middleware\RegistrationAllowedGatekeeper::class,],], 'river/delete'=>[], 'settings/notifications'=>[], 'settings/notifications/subscriptions'=>[], 'user/changepassword'=>['access'=> 'public'], 'user/requestnewpassword'=>['access'=> 'public'], 'useradd'=>['access'=> 'admin'], 'usersettings/save'=>[], 'widgets/add'=>[], 'widgets/delete'=>[], 'widgets/move'=>[], 'widgets/save'=>[],]
Definition: actions.php:73
ElggMetadata.
getObjectFromID(int $id)
{For a given ID, return the object associated with it.This is used by the river functionality primari...
initializeAttributes()
{{Initialize the attributes array.This is vital to distinguish between metadata and base parameters....
__construct(?\stdClass $row=null)
Constructor.
save()
Save metadata object.
canEdit(int $user_guid=0)
Determines whether the user can edit this piece of metadata.
const ACCESS_PUBLIC
Definition: constants.php:12
_elgg_services()
Get the global service provider.
Definition: elgglib.php:353
elgg_has_access_to_entity(int $entity_guid, int $user_guid=0)
Can a user access an entity.
Definition: access.php:91
elgg_get_metadata_from_id(int $id)
Elgg metadata Functions to manage entity metadata.
Definition: metadata.php:16
$value
Definition: generic.php:51
$user_guid
Definition: login_as.php:10
if($container instanceof ElggGroup && $container->guid !=elgg_get_page_owner_guid()) $key
Definition: summary.php:44
if(parse_url(elgg_get_site_url(), PHP_URL_PATH) !=='/') if(file_exists(elgg_get_root_path() . 'robots.txt'))
Set robots.txt.
Definition: robots.php:10