Ejemplo n.º 1
0
 /**
  * register widget fields feature
  * @param $widget: widget instance
  * @param $feature: give feature name by hoangweb
  */
 public static function register_widget_feature($widget, $feature)
 {
     if (!isset(self::$widgets_fields[$feature])) {
         self::$widgets_fields[$feature] = array();
     }
     $register_features = HW_AWC_WidgetFeatures::get_all_features();
     //get all register features
     //load widget feature from enternal
     $class = self::get_feature_class_byName($feature);
     //'AWC_WidgetFeature_' . $feature;
     if (class_exists($class)) {
         $class = new $class($widget, array());
         $class->feature_name = $feature;
         //widget feature identifier
         $class->feature_url = HW_AWC_WidgetFeatures_URL . '/' . $feature;
         $class->feature_path = HW_AWC_WidgetFeatures_PATH . '/' . $feature;
         $class->option('feature_alias', $register_features[$feature]);
         //set static options
         $class->_static_option('feature_name', $class->feature_name);
         $class->_static_option('feature_url', $class->feature_url);
         $class->_static_option('feature_path', $class->feature_path);
         $class->feature_loaded();
         //add widget feature to manager
         HW_Widget_Features_Setting::add_widget_feature($feature, $class);
         self::_setup_actions($class);
     }
     //prevent to duplicate widgets in one feature ($widget->id_base)
     self::$widgets_fields[$feature][$widget->id_base . '-' . $widget->number] = array('widget' => $widget, 'class' => $class);
 }