Welcome, Guest
Username: Password: Remember me

TOPIC: Displaying the Parent in a Forked Brick

Displaying the Parent in a Forked Brick 17 Aug 2016 09:03 #14457

  • organicwebs
  • organicwebs's Avatar
  • Offline
  • Premium Member
  • Chris
  • Posts: 133
  • Thank you received: 21
  • Karma: 4
Hi Everyone.

I was trying to applying ACL to a formbrick - so that an administrator group could see it - and not a general user. (Before somebody mentions it, I was avoiding copying forms as that duplicates all the custom coding work).

Anyhow - I was going to apply my ACL code to my forked view formbrick.php - and then call up the parent formbrick.php. By calling the Parent (original) - any changes I make in the builder will still have effect.

But - I am having difficulty in calling the parent formbrick.php from with the forked formbrick.php. I'm getting this error...
Fatal error: Call to undefined method JViewLegacy::_parentDisplay()

So is this part of the documentation correct for forked bricks?...



How do we call the original brick from a fork? (Is it possible?)

Cheers
Just call me Chris :)
The administrator has disabled public write access.

Displaying the Parent in a Forked Brick 24 Aug 2016 21:10 #14483

  • Romkabouter
  • Romkabouter's Avatar
  • Offline
  • Elite Member
  • Posts: 310
  • Thank you received: 131
  • Karma: 48
What I do in a forked view file:
class MyComponentViewView1 extends MyComponentCkViewView1
{
	protected function displayDefault($tpl = null)
	{
	    parent::displayDefault($tpl);
           //other stuff
	}
}

works fine....
Or do I misunderstand?
The administrator has disabled public write access.

Displaying the Parent in a Forked Brick 25 Aug 2016 11:53 #14487

  • admin
  • admin's Avatar
  • Offline
  • Administrator
  • Chef
  • Posts: 3711
  • Thank you received: 987
  • Karma: 140
This function in the view apply for the views, not for the brick.

What you can do is to check your ACL in the view displayXxx() function,
And then in the default.php template file, just test the var and switch the rendering or not of the brick.
Hope it helps.

I think the code given in the docs is deprecated now.
You don't need to call _parentDisplay() anymore because it is called automatically in the display() function, you might not need to fork.
Coding is now a piece of cake
The administrator has disabled public write access.
Time to create page: 0.111 seconds

Get Started