public function testElggEnableAnnotations() { $e = new ElggObject(); $e->save(); for ($i = 0; $i < 30; $i++) { $e->annotate('test_annotation', rand(0, 10000)); } $options = array('guid' => $e->getGUID(), 'limit' => 0); $this->assertTrue(elgg_disable_annotations($options)); // cannot see any annotations so returns null $this->assertNull(elgg_enable_annotations($options)); access_show_hidden_entities(true); $this->assertTrue(elgg_enable_annotations($options)); access_show_hidden_entities(false); $annotations = elgg_get_annotations($options); $this->assertIdentical(30, count($annotations)); $this->assertTrue($e->delete()); }
/** * Enables annotations for this entity, optionally based on name. * * @warning Before calling this, you must use {@link access_show_hidden_entities()} * * @param string $name An options name of annotations to enable. * @return bool * @since 1.8 */ public function enableAnnotations($name = '') { $options = array('guid' => $this->guid, 'limit' => 0); if ($name) { $options['annotation_name'] = $name; } return elgg_enable_annotations($options); }