diff --git a/classes/BookmarkWidget.inc b/classes/BookmarkWidget.inc index 87e2999..ccb2911 100644 --- a/classes/BookmarkWidget.inc +++ b/classes/BookmarkWidget.inc @@ -44,6 +44,17 @@ class ComicPressBookmarkWidget extends WP_Widget { ) ) ); + + $this->default_instance = array( + 'title' => __('Bookmark This Page', 'comicpress'), + 'mode' => array_shift(array_keys($this->text_fields)) + ); + + foreach (array_values($this->text_fields) as $fields) { + foreach ($fields as $field => $info) { + $this->default_instance[$field] = $info['default']; + } + } } function init() {} @@ -69,17 +80,7 @@ class ComicPressBookmarkWidget extends WP_Widget { // @codeCoverageIgnoreEnd function form($instance) { - $instance = (array)$instance; - - $defaults = array('title' => '', 'mode' => 'three-button'); - - foreach (array_values($this->text_fields) as $field => $info) { - if (isset($info['default'])) { - $defaults[$field] = $info['default']; - } - } - - $instance = array_merge($defaults, $instance); ?> + $instance = array_merge($this->default_instance, (array)$instance); ?>