Welcome, Guest
Username: Password: Remember me
  • Page:
  • 1

TOPIC:

Custom button using JDom markup 28 Aug 2016 16:31 #14492

  • MorganL
  • MorganL's Avatar Topic Author
  • Offline
  • Platinum Member
  • Platinum Member
  • Posts: 438
  • Thank you received: 53
I know how to create buttons in J-Cook components to do whatever function i like.. open in modal, edit, etc

However I would like to take J-Cook code snippets.. i.e
<?php echo JDom::_('html.fly', array(
 'commandAcl' => array('core.edit.own', 'core.edit'),
 'dataKey' => 'title',
 'dataObject' => $row,
 'num' => $i,
 'task' => 'records.edit'
));?>

but add my own label.. so the task is the same, the correct record opens, but I don't have to construct the button manually.. i something like this
<?php echo JDom::_('html.fly', array(
 'commandAcl' => array('core.edit.own', 'core.edit'),
 'label' => 'Edit this Record',
 'dataObject' => $row,
 'num' => $i,
 'task' => 'records.edit'
));?>

so instead of the hyperlink using the $this->item->title entry, I have a clickable 'Edit this Record' which does the same thing.

Like I said, I know how to construct the button, but would be nice to stick to the JDOM method above and let the button be generated like other content in the component. I suspect this is possible, but I cant find the right combination in the array
Morgan Leecy MCSE

Novell / Linux
PHP. MYSQL, Apache, node.js
Coldfusion, JQuery, HTML5
Joomla
The following user(s) said Thank You: vlemos

Please Log in or Create an account to join the conversation.

Custom button using JDom markup 29 Aug 2016 11:05 #14493

  • admin
  • admin's Avatar
  • Offline
  • Administrator
  • Administrator
  • Chef
  • Posts: 3711
  • Thank you received: 986
I think this would do the job :
html.link instead of html.fly
content instead of label
dataObject is not required.
<?php echo JDom::_('html.link', array(
 'commandAcl' => array('core.edit.own', 'core.edit'),
 'content' => 'Edit this Record',
 'num' => $i,
 'task' => 'records.edit'
));?>



Note, that 'Fly' is only used for treating an object. When you want a simple link, most of the case, you can use a shorter way. (html.link is faster in CPU)

As you see, Cook is improving the presentation and the docs are coming... It is long work.
Coding is now a piece of cake
The following user(s) said Thank You: MorganL, vlemos

Please Log in or Create an account to join the conversation.

Custom button using JDom markup 29 Aug 2016 12:15 #14497

  • MorganL
  • MorganL's Avatar Topic Author
  • Offline
  • Platinum Member
  • Platinum Member
  • Posts: 438
  • Thank you received: 53
Beautiful

I have started to see how much easier it is to call tasks and commands. Brilliant, you are making my life TOO easy
Morgan Leecy MCSE

Novell / Linux
PHP. MYSQL, Apache, node.js
Coldfusion, JQuery, HTML5
Joomla

Please Log in or Create an account to join the conversation.

  • Page:
  • 1
Time to create page: 0.078 seconds
  I still don't believe he can really be human to do all this ! From all of the forums that I've ever participated in this is certainly the one that most encapsulates the feeling of being truly open source where everyone's opinions and contributions can and will shape the development of the service! It's truly awesome! Hope you enjoy cooking and look forward to reading and contributing to any of the editorial work that you proposed too!! Thanks
Gez (audibleid - JED)

Get Started