/** * Prepare execute hook. * * @return void */ protected function prepareExecute() { $this->context = ContextHelper::fromController($this, 'edit'); parent::prepareExecute(); $this->recordId = $this->input->get($this->urlVar); // Populate the row id from the session. $this->data[$this->key] = $this->recordId; }
/** * Method to instantiate the view. * * @param Model $model The model object. * @param Container $container DI Container. * @param array $config View config. * @param \SplPriorityQueue $paths Paths queue. */ public function __construct(Model $model = null, Container $container = null, $config = array(), \SplPriorityQueue $paths = null) { if (!empty($config['engine']) && $config['engine'] instanceof EngineInterface) { $this->engine = $config['engine']; } $this->context = ContextHelper::fromView($this); parent::__construct($model, $container, $config); // Setup dependencies. $this->paths = $paths ?: $this->loadPaths(); }
/** * Constructor * * @param array $config An array of configuration options (name, state, dbo, table_path, ignore_request). * @param JoomlaContainer $container Service container. * @param Registry $state The model state. * @param \JDatabaseDriver $db The database adapter. * * @throws \Exception */ public function __construct($config = array(), JoomlaContainer $container = null, Registry $state = null, \JDatabaseDriver $db = null) { $this->prefix = $this->getPrefix($config); $this->option = 'com_' . $this->prefix; // Guess name $this->name = $this->name ?: ArrayHelper::getValue($config, 'name', $this->getName()); // Register the paths for the form $this->registerTablePaths($config); // Set the clean cache event $this->eventCleanCache = $this->eventCleanCache ?: ArrayHelper::getValue($config, 'event_clean_cache', 'onContentCleanCache'); $this->container = $container ?: $this->getContainer(); $this->resetCache(); parent::__construct($state, $db); $this->state->loadArray($config); // Guess the context as Option.ModelName. $this->context = $this->context ?: ContextHelper::fromModel($this); // Set the internal state marker - used to ignore setting state from the request if (empty($config['ignore_request'])) { // Protected method to auto-populate the model state. $this->populateState(); } }
/** * Instantiate the controller. * * @param \JInput $input The input object. * @param \JApplicationCms $app The application object. * @param array $config Additional config. * * @throws \Exception */ public function __construct(\JInput $input = null, \JApplicationCms $app = null, $config = array()) { parent::__construct($input, $app, $config); $this->context = $this->context ?: ContextHelper::fromController($this); $this->textPrefix = strtoupper($this->option); }