예제 #1
0
 /**
  * Creates the object instance.
  * @param \Cms\Classes\Page $page Specifies the CMS page.
  * @param \Cms\Classes\Layout $layout Specifies the CMS layout.
  * @param \Cms\Classes\Controller $controller Specifies the CMS controller.
  */
 public function __construct($page, $layout, $controller)
 {
     $this->page = $page;
     $this->layout = $layout;
     $this->controller = $controller;
     parent::__construct();
 }
예제 #2
0
 /**
  * Constructor
  * @param \Backend\Classes\Controller $controller
  * @param array $configuration Proactive configuration definition.
  */
 public function __construct($controller, $configuration = [])
 {
     $this->controller = $controller;
     $this->viewPath = $this->configPath = $this->guessViewPath('/partials');
     $this->assetPath = $this->guessViewPath('/assets', true);
     /*
      * Apply configuration values to a new config object, if a parent
      * consutrctor hasn't done it already.
      */
     if ($this->config === null) {
         $this->config = $this->makeConfig($configuration);
     }
     /*
      * If no alias is set by the configuration.
      */
     if (!isset($this->alias)) {
         $this->alias = isset($this->config->alias) ? $this->config->alias : $this->defaultAlias;
     }
     /*
      * Prepare assets used by this widget.
      */
     $this->loadAssets();
     parent::__construct();
     /*
      * Initialize the widget.
      */
     if (!$this->getConfig('noInit', false)) {
         $this->init();
     }
 }
예제 #3
0
 /**
  * Component constructor. Takes in the page or layout code section object
  * and properties set by the page or layout.
  */
 public function __construct(CodeBase $cmsObject = null, $properties = [])
 {
     if ($cmsObject !== null) {
         $this->controller = $cmsObject->controller;
         $this->page = $cmsObject;
     }
     $this->properties = $this->validateProperties($properties);
     $className = Str::normalizeClassName(get_called_class());
     $this->dirName = strtolower(str_replace('\\', '/', $className));
     $this->assetPath = Config::get('cms.pluginsPath', '/plugins') . dirname(dirname($this->dirName));
     parent::__construct();
 }
예제 #4
0
 /**
  * Constructor.
  */
 public function __construct()
 {
     /*
      * Allow early access to route data.
      */
     $this->action = BackendController::$action;
     $this->params = BackendController::$params;
     /*
      * Apply $guarded methods to hidden actions
      */
     $this->hiddenActions = array_merge($this->hiddenActions, $this->guarded);
     /*
      * Define layout and view paths
      */
     $this->layout = $this->layout ?: 'default';
     $this->layoutPath = Skin::getActive()->getLayoutPaths();
     $this->viewPath = $this->configPath = $this->guessViewPath();
     /*
      * Add layout paths from the plugin / module context
      */
     $relativePath = dirname(dirname(strtolower(str_replace('\\', '/', get_called_class()))));
     $this->layoutPath[] = '~/modules/' . $relativePath . '/layouts';
     $this->layoutPath[] = '~/plugins/' . $relativePath . '/layouts';
     parent::__construct();
     /*
      * Media Manager widget is available on all back-end pages
      */
     $manager = new MediaManager($this, 'ocmediamanager');
     $manager->bindToController();
 }
예제 #5
0
 /**
  * Constructor.
  */
 public function __construct()
 {
     /*
      * Allow early access to route data.
      */
     $this->action = BackendController::$action;
     $this->params = BackendController::$params;
     /*
      * Apply $guarded methods to hidden actions
      */
     $this->hiddenActions = array_merge($this->hiddenActions, $this->guarded);
     /*
      * Define layout and view paths
      */
     $this->layout = 'default';
     $this->layoutPath = Skin::getActive()->getLayoutPaths();
     // Option A: (@todo Determine which is faster by benchmark)
     // $relativePath = strtolower(str_replace('\\', '/', get_called_class()));
     // $this->viewPath = $this->configPath = ['modules/' . $relativePath, 'plugins/' . $relativePath];
     // Option B:
     $this->viewPath = $this->configPath = $this->guessViewPath();
     parent::__construct();
 }
예제 #6
0
 /**
  * Dynamically handle calls into the controller instance.
  * @param string $method
  * @param array $parameters
  * @return mixed
  */
 public function __call($method, $parameters)
 {
     try {
         parent::__call($method, $parameters);
     } catch (BadMethodCallException $ex) {
     }
     if (method_exists($this->controller, $method)) {
         return call_user_func_array([$this->controller, $method], $parameters);
     }
     throw new BadMethodCallException(Lang::get('cms::lang.component.method_not_found', ['name' => get_class($this), 'method' => $method]));
 }
예제 #7
0
 /**
  * Creates an instance of the object and associates it with a CMS theme.
  * @param \Cms\Classes\Theme $theme Specifies the theme the object belongs to.
  */
 public function __construct(Theme $theme)
 {
     $this->theme = $theme;
     $this->allowedExtensions = self::getEditableExtensions();
     parent::__construct();
 }
예제 #8
0
 /**
  * Handle dynamic method calls into the model.
  *
  * @param  string  $method
  * @param  array  $parameters
  * @return mixed
  */
 public function __call($method, $parameters)
 {
     try {
         return parent::__call($method, $parameters);
     } catch (BadMethodCallException $ex) {
         $query = $this->newQuery();
         return call_user_func_array([$query, $method], $parameters);
     }
 }
예제 #9
0
 /**
  * Creates an instance of the object and associates it with a CMS component.
  * @param \Cms\Classes\ComponentBase $component Specifies the component the object belongs to.
  */
 public function __construct(ComponentBase $component)
 {
     $this->component = $component;
     parent::__construct();
 }