-
Notifications
You must be signed in to change notification settings - Fork 5
New api to support Two form in one page. #36
Conversation
libraries/cms/html/grid.php
Outdated
* | ||
* @return mixed String of html with a checkbox if item is not checked out, null if checked out. | ||
* | ||
* @since 1.5 | ||
*/ | ||
public static function id($rowNum, $recId, $checkedOut = false, $name = 'cid', $stub = 'cb') |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You need to add the new parameter at the end or you’re breaking b/c
libraries/cms/html/jgrid.php
Outdated
@@ -155,7 +168,7 @@ public static function state($states, $value, $i, $prefix = '', $enabled = true, | |||
* @see JHtmlJGrid::state() | |||
* @since 1.6 | |||
*/ | |||
public static function published($value, $i, $prefix = '', $enabled = true, $checkbox = 'cb', $publish_up = null, $publish_down = null) | |||
public static function published($value, $i, $prefix = '', $enabled = true, $formId = null, $checkbox = 'cb', $publish_up = null, $publish_down = null) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same here
libraries/cms/html/jgrid.php
Outdated
* @param string $checkbox An optional prefix for checkboxes. | ||
* | ||
* @return string The HTML markup | ||
* | ||
* @see JHtmlJGrid::state() | ||
* @since 1.6 | ||
*/ | ||
public static function isdefault($value, $i, $prefix = '', $enabled = true, $checkbox = 'cb') | ||
public static function isdefault($value, $i, $prefix = '', $enabled = true, $formId = null, $checkbox = 'cb') |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
And here
* @param string $checkbox An optional prefix for checkboxes. | ||
* | ||
* @return string The HTML markup | ||
* | ||
* @since 1.6 | ||
*/ | ||
public static function checkedout($i, $editorName, $time, $prefix = '', $enabled = false, $checkbox = 'cb') |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
And here
libraries/cms/html/jgrid.php
Outdated
* @param string $checkbox An optional prefix for checkboxes. | ||
* | ||
* @return string The HTML markup | ||
* | ||
* @since 1.6 | ||
*/ | ||
public static function orderUp($i, $task = 'orderup', $prefix = '', $text = 'JLIB_HTML_MOVE_UP', $enabled = true, $checkbox = 'cb') | ||
public static function orderUp($i, $task = 'orderup', $prefix = '', $text = 'JLIB_HTML_MOVE_UP', $enabled = true, $formId = null, $checkbox = 'cb') | ||
{ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
And here
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nope, it needs to be the last one, otherwise, we have a b/c break!!!
libraries/cms/html/jgrid.php
Outdated
* @param string $checkbox An optional prefix for checkboxes. | ||
* | ||
* @return string The HTML markup | ||
* | ||
* @since 1.6 | ||
*/ | ||
public static function orderDown($i, $task = 'orderdown', $prefix = '', $text = 'JLIB_HTML_MOVE_DOWN', $enabled = true, $checkbox = 'cb') | ||
public static function orderDown($i, $task = 'orderdown', $prefix = '', $text = 'JLIB_HTML_MOVE_DOWN', $enabled = true, $formId = null, $checkbox = 'cb') | ||
{ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
And here
@dgrammatiko Done! :) |
@dgrammatiko I think i need to create this PR to main repo right ? |
Yes this needs to be done against the 4.0-dev |
->text($text) | ||
->task($task) | ||
->listCheck($list); | ||
if ($formId !== null) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we save some lines if we do it like this
...
if ($formId !== null)
{
$this->form($formId);
}
$this->name($name);
$this->text($text);
$this->task($task);
$this->listCheck($list);
...
I have tested this branch successful.
|
Now I am not sure how to merge this branch. Should we merge here in the project, or belongs it to the Main project? |
Please make a or in the 4.0 branch and then we can merge it there. The code will be shortly available here then |
Close as merged in #39 |
Summary of Changes
New API to support custom form with different id's. It supports more than two form in one page.
Mulitiselect :
JHtml::_('behavior.multiselect', 'your id ');
like take a id =
updateform
JHtml::_('behavior.multiselect', 'updateForm');
Grid id :
HTMLHelper::_('grid.id', $i, $value->hash_id, 'updateForm');
Publish :
JHtml::_('jgrid.published', $value->state, $i, 'template.', 1, 'updateForm');
Tool Bar :
ToolbarHelper::custom('template.deleteHistory', 'delete', 'move', 'JTOOLBAR_DELETE', true, 'updateForm');
Pass your form id as a parameter.
Hope this ok. But the review is necessary.
Testing Instructions
Add an admin form with id =
adminfrom
and add the second form with id=what ever you want
. In one pageExpected result
All form working as expected.
Actual result
Old API only select the first form in the page with id =
adminform
. Which causes the error in working on the second form.Documentation Changes Required
Yes
@dgrammatiko Please take a look here. Is any thing left to support custom form id ?