Skip to content

Commit

Permalink
Convert the front
Browse files Browse the repository at this point in the history
  • Loading branch information
laoneo committed May 22, 2017
1 parent def981c commit fff25f2
Show file tree
Hide file tree
Showing 4 changed files with 101 additions and 48 deletions.
49 changes: 49 additions & 0 deletions components/com_fields/Controller/Controller.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
<?php
/**
* @package Joomla.Site
* @subpackage com_fields
*
* @copyright Copyright (C) 2005 - 2017 Open Source Matters, Inc. All rights reserved.
* @license GNU General Public License version 2 or later; see LICENSE.txt
*/
namespace Joomla\Component\Fields\Site\Controller;

defined('_JEXEC') or die;

use Joomla\CMS\Application\CMSApplication;
use Joomla\CMS\Mvc\Factory\MvcFactoryInterface;

/**
* Base controller class for Fields Component.
*
* @since 3.7.0
*/
class Controller extends \Joomla\CMS\Controller\Controller
{

/**
* Constructor.
*
* @param array $config An optional associative array of configuration settings.
* Recognized key values include 'name', 'default_task', 'model_path', and
* 'view_path' (this list is not meant to be comprehensive).
* @param MvcFactoryInterface $factory The factory.
* @param CMSApplication $app The JApplication for the dispatcher
* @param \JInput $input Input
*
* @since 3.7.0
*/
public function __construct($config = array(), MvcFactoryInterface $factory = null, $app = null, $input = null)
{
// Frontpage Editor Fields Button proxying:
if ($input->get('view') === 'fields' && $input->get('layout') === 'modal')
{
// Load the backend language file.
$app->getLanguage()->load('com_fields', JPATH_ADMINISTRATOR);

$config['base_path'] = JPATH_COMPONENT_ADMINISTRATOR;
}

parent::__construct($config, $factory, $app, $input);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,18 @@
* @copyright Copyright (C) 2005 - 2017 Open Source Matters, Inc. All rights reserved.
* @license GNU General Public License version 2 or later; see LICENSE.txt
*/
namespace Joomla\Component\Fields\Site\Controller;

defined('_JEXEC') or die;

use Joomla\CMS\Controller\Controller;

/**
* Fields controller class for Fields Component.
*
* @since 3.7.0
*/
class FieldsControllerField extends JControllerLegacy
class Field extends Controller
{
/**
* Stores the form content into the user session.
Expand All @@ -24,11 +28,11 @@ class FieldsControllerField extends JControllerLegacy
*/
public function storeform()
{
JSession::checkToken() or jexit(JText::_('JINVALID_TOKEN'));
\JSession::checkToken() or jexit(\JText::_('JINVALID_TOKEN'));

$app = JFactory::getApplication();
$app = \JFactory::getApplication();
$data = $this->input->get($this->input->get('formcontrol', 'jform'), array(), 'array');
$parts = FieldsHelper::extract($this->input->getCmd('context'));
$parts = \FieldsHelper::extract($this->input->getCmd('context'));

if ($parts)
{
Expand All @@ -38,7 +42,7 @@ public function storeform()
$redirectUrl = base64_decode($this->input->get->getBase64('return'));

// Don't redirect to an external URL.
If (!JUri::isInternal($redirectUrl))
If (!\JUri::isInternal($redirectUrl))
{
$redirectUrl = 'index.php';
}
Expand Down
43 changes: 0 additions & 43 deletions components/com_fields/controller.php

This file was deleted.

43 changes: 43 additions & 0 deletions components/com_fields/dispatcher.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
<?php
/**
* @package Joomla.Site
* @subpackage com_fields
*
* @copyright Copyright (C) 2005 - 2017 Open Source Matters, Inc. All rights reserved.
* @license GNU General Public License version 2 or later; see LICENSE.txt
*/

defined('_JEXEC') or die;

use Joomla\CMS\Dispatcher\Dispatcher;

/**
* Dispatcher class for com_fields
*
* @since __DEPLOY_VERSION__
*/
class FieldsDispatcher extends Dispatcher
{
/**
* The extension namespace
*
* @var string
*
* @since __DEPLOY_VERSION__
*/
protected $namespace = 'Joomla\\Component\\Fields';

/**
* Dispatch a controller task. Redirecting the user if appropriate.
*
* @return void
*
* @since __DEPLOY_VERSION__
*/
public function dispatch()
{
JLoader::register('FieldsHelper', JPATH_ADMINISTRATOR . '/components/com_fields/helpers/fields.php');

parent::dispatch();
}
}

0 comments on commit fff25f2

Please sign in to comment.