public function set_data($data) { if (!empty($data->id)) { $collection = new \mod_mediagallery\collection($data); $data->tags = $collection->get_tags(); if ($collection->count_galleries() && $collection->is_assessable()) { $this->_form->hardFreeze('colltype'); } } parent::set_data($data); }