4

I'm trying to override com_content controller (administrator/components/com_content/controller.php), for this I have installed the joomla-override plugin and followed as the documentation says.

Created a code folder inside the root of administrator/ directory, and inside of it I've created a com_content directory with a file named controller.php in its root.

The file look like this:

<?php
/**
 * @package     Joomla.Administrator
 * @subpackage  com_content
 *
 * @copyright   Copyright (C) 2005 - 2014 Open Source Matters, Inc. All rights reserved.
 * @license     GNU General Public License version 2 or later; see LICENSE.txt
 */

defined('_JEXEC') or die;

/**
 * Component Controller
 *
 * @package     Joomla.Administrator
 * @subpackage  com_content
 * @since       1.5
 */
class ContentController extends ContentControllerDefault
{

        /**
         * @var         string  The default view.
         * @since   1.6
         */
        protected $default_view = 'articles';

        /**
         * Method to display a view.
         *
         * @param   boolean                     If true, the view output will be cached
         * @param   array  An array of safe url parameters and their variable types, for valid values see {@link JFilterInput::clean()}.
         *
         * @return  JController         This object to support chaining.
         *
         * @since   1.5
         */
        public function display($cachable = false, $urlparams = false)
        {
             var_dump("Test");
             return $this;
        }

}

As you can see, the class name follows the overriding rules of the plugin extending the `ContentControllerDefault.

The var_dump should appear below the article edition form, but it is not shown. It's like the class is not being overriden. Any ideas?

Thank you.

7

Ok. Solved it. The problem was I was putting the code/ folder in administrator/ root, instead I should have put it inside the template folder (administrator/templates/my_template/code/).

Now it works.

  • Don't forget to select your solution as the answer :) – TryHarder Apr 17 '15 at 22:57

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.