Welcome, Guest
Username: Password: Remember me

TOPIC: Custom button using JDom markup

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

  • MorganL
  • MorganL's Avatar
  • Offline
  • Platinum Member
  • Posts: 438
  • Thank you received: 53
  • Karma: 15
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 administrator has disabled public write access.
The following user(s) said Thank You: vlemos

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

  • admin
  • admin's Avatar
  • Offline
  • Administrator
  • Chef
  • Posts: 3711
  • Thank you received: 987
  • Karma: 140
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 administrator has disabled public write access.
The following user(s) said Thank You: MorganL, vlemos

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

  • MorganL
  • MorganL's Avatar
  • Offline
  • Platinum Member
  • Posts: 438
  • Thank you received: 53
  • Karma: 15
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
The administrator has disabled public write access.
Time to create page: 0.141 seconds

Get Started