'', 'name' => $this->addon_name(), 'type' =>'', 'order' =>'', 'location' =>'', 'page_id' =>'', 'page_type' =>'', 'before' => true, 'after' => true ]; $this->args = array_merge($defaults,$args); $this->base_preview_image_path = asset('assets/backend/page-builder'); try { $this->rand_number = random_int(999, 99999); } catch (\Exception $e) { } } /** * preview_image * this method must have to implement by all widget to show a preview image at admin panel so that user know about the design which he want to use * @since 1.0.0 * */ abstract public function preview_image(); /** * admin_render * this method must have to implement by all widget to render admin panel widget content * @since 1.0.0 * */ abstract public function admin_render(); /** * frontend_render * this method must have to implement by all widget to render frontend widget content * @since 1.0.0 * */ abstract public function frontend_render(); /** * widget_title * this method must have to implement by all widget to register widget title * @since 1.0.0 * */ abstract public function addon_title(); /** * addon_name * get addon name from class name * @since 1.0.0 * */ public function addon_name() { return substr(strrchr(static::class, "\\"),1); } /** * addon_namespace * get addon class namespace * @since 1.0.0 * */ public function addon_namespace() { return static::class; } /** * widget_name * this method must have to implement by all widget to register widget name * @since 1.0.0 * */ public function enable() : bool { // TODO: Implement widget_name() method. return true; } /** * default_fields * this method will return all the default field required by any widget * @since 1.0.0 * */ public function default_fields(): string { //all initial field $output = ''; $output .= !empty($this->args['id']) ? '' : ''; $output .= ''; $output .= ''; $output .= ''; $output .= ''; $output .= ''; $output .= ''; $output .= ''; return $output; } /** * get_settings * this method will return all the settings value saved for widget * @since 1.0.0 * */ public function get_settings() { $widget_data = !empty($this->args['id']) ? PageBuilder::find($this->args['id']) : []; $widget_data = !empty($widget_data) ? unserialize($widget_data->addon_settings,['class' => false]) : []; return $widget_data; } /** * widget_before * this method will add widget before html markup for widget in frontend * @since 1.0.0 */ public function addon_area_before($class = null) { return '