/** * Update the widget so it shows the correct title and has the correct template */ private function updateWidget() { $editUrl = Model::createURLForAction('Edit', 'ContentBlocks', (string) $this->locale) . '&id=' . $this->id; // update data for the extra // @TODO replace this with an implementation with doctrine $extras = Model::getExtras([$this->extraId]); $extra = reset($extras); $data = ['id' => $this->id, 'language' => (string) $this->locale, 'edit_url' => $editUrl]; if (isset($extra['data'])) { $data = $data + (array) $extra['data']; } $data['custom_template'] = $this->template; $data['extra_label'] = $this->title; Model::updateExtra($this->extraId, 'data', $data); }