Skip to content

Commit

Permalink
Upgrade: Change Form::input() to Form::control()
Browse files Browse the repository at this point in the history
  • Loading branch information
rchavik committed Sep 17, 2020
1 parent ca78aa9 commit 41e51d7
Show file tree
Hide file tree
Showing 61 changed files with 212 additions and 212 deletions.
4 changes: 2 additions & 2 deletions Acl/templates/Admin/Actions/form.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,15 +22,15 @@

$this->append('tab-content');

echo $this->Form->input('parent_id', [
echo $this->Form->control('parent_id', [
'options' => $acos,
'empty' => true,
'label' => __d('croogo', 'Parent'),
]);
$this->Form->templates([
'class' => 'span10',
]);
echo $this->Form->input('alias', [
echo $this->Form->control('alias', [
'label' => __d('croogo', 'Alias'),
]);

Expand Down
2 changes: 1 addition & 1 deletion Acl/templates/element/admin/parent_role.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<?php
echo $this->Form->input('parent_id', [
echo $this->Form->control('parent_id', [
'help' => __d('croogo', 'When set, permissions from parent role are inherited'),
]);
2 changes: 1 addition & 1 deletion Acl/templates/element/admin/roles.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
$selected = $entity->roles ?
Hash::extract($entity->roles, '{n}.id') :
[];
echo $this->Form->input('roles._ids', [
echo $this->Form->control('roles._ids', [
'value' => $selected,
'class' => 'c-select',
'options' => $validRoles,
Expand Down
2 changes: 1 addition & 1 deletion Acl/templates/element/admin/row_acl.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
continue;
}
$field = 'rolePermissions.' . $role['id'];
$input = $this->Form->input($field, [
$input = $this->Form->control($field, [
'type' => 'checkbox',
'checked' => $role['allowed'] ? true : false,
'label' => $role['title'],
Expand Down
22 changes: 11 additions & 11 deletions Blocks/templates/Admin/Blocks/form.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,35 +23,35 @@

$this->append('tab-content');

echo $this->Html->tabStart('block-basic') . $this->Form->input('title', [
echo $this->Html->tabStart('block-basic') . $this->Form->control('title', [
'label' => __d('croogo', 'Title'),
'data-slug' => '#alias',
]) . $this->Form->input('alias', [
]) . $this->Form->control('alias', [
'label' => __d('croogo', 'Alias'),
'help' => __d('croogo', 'unique name for your block'),
]) . $this->Form->input('region_id', [
]) . $this->Form->control('region_id', [
'label' => __d('croogo', 'Region'),
'help' => __d('croogo', 'if you are not sure, choose \'none\''),
'class' => 'c-select',
]) . $this->Form->input('body', [
]) . $this->Form->control('body', [
'label' => __d('croogo', 'Body'),
]) . $this->Form->input('class', [
]) . $this->Form->control('class', [
'label' => __d('croogo', 'Class'),
]) . $this->Form->input('element', [
]) . $this->Form->control('element', [
'label' => __d('croogo', 'Element'),
]) . $this->Form->input('cell', [
]) . $this->Form->control('cell', [
'label' => __d('croogo', 'Cell'),
]);
echo $this->Html->tabEnd();

echo $this->Html->tabStart('block-visibilities') . $this->Form->input('visibility_paths', [
echo $this->Html->tabStart('block-visibilities') . $this->Form->control('visibility_paths', [
'type' => 'stringlist',
'label' => __d('croogo', 'Visibility Paths'),
'help' => __d('croogo', 'Enter one URL per line. Leave blank if you want this Block to appear in all pages.'),
]);
echo $this->Html->tabEnd();

echo $this->Html->tabStart('block-params') . $this->Form->input('params', [
echo $this->Html->tabStart('block-params') . $this->Form->control('params', [
'type' => 'stringlist',
'label' => __d('croogo', 'Params'),
]);
Expand All @@ -63,13 +63,13 @@
echo $this->Html->beginBox(__d('croogo', 'Publishing'));
echo $this->element('Croogo/Core.admin/buttons', ['type' => 'block']);
echo $this->element('Croogo/Core.admin/publishable');
echo $this->Form->input('show_title', [
echo $this->Form->control('show_title', [
'label' => __d('croogo', 'Show title ?'),
]);
echo $this->Html->endBox();

echo $this->Html->beginBox(__d('croogo', 'Access control'));
echo $this->Form->input('visibility_roles', [
echo $this->Form->control('visibility_roles', [
'class' => 'c-select',
'options' => $roles,
'multiple' => true,
Expand Down
2 changes: 1 addition & 1 deletion Blocks/templates/Admin/Blocks/index.php
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@
$this->end();
if (!$chooser):
$this->start('bulk-action');
echo $this->Form->input('action', [
echo $this->Form->control('action', [
'label' => __d('croogo', 'Bulk action'),
'class' => 'c-select',
'options' => [
Expand Down
4 changes: 2 additions & 2 deletions Blocks/templates/Admin/Regions/form.php
Original file line number Diff line number Diff line change
Expand Up @@ -27,10 +27,10 @@

$this->append('tab-content');

echo $this->Html->tabStart('region-main') . $this->Form->input('title', [
echo $this->Html->tabStart('region-main') . $this->Form->control('title', [
'label' => __d('croogo', 'Title'),
'data-slug' => '#alias'
]) . $this->Form->input('alias', [
]) . $this->Form->control('alias', [
'label' => __d('croogo', 'Alias'),
]);
echo $this->Html->tabEnd();
Expand Down
38 changes: 19 additions & 19 deletions Contacts/templates/Admin/Contacts/form.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,48 +22,48 @@

$this->append('tab-content');

echo $this->Html->tabStart('contact-basic') . $this->Form->input('id') . $this->Form->input('title', [
echo $this->Html->tabStart('contact-basic') . $this->Form->control('id') . $this->Form->control('title', [
'label' => __d('croogo', 'Title'),
'data-slug' => '#alias',
]) . $this->Form->input('alias', [
]) . $this->Form->control('alias', [
'label' => __d('croogo', 'Alias'),
]) . $this->Form->input('email', [
]) . $this->Form->control('email', [
'label' => __d('croogo', 'Email'),
]) . $this->Form->input('body', [
]) . $this->Form->control('body', [
'label' => __d('croogo', 'Body'),
]);
echo $this->Html->tabEnd();

echo $this->Html->tabStart('contact-details') . $this->Form->input('name', [
echo $this->Html->tabStart('contact-details') . $this->Form->control('name', [
'label' => __d('croogo', 'Name'),
]) . $this->Form->input('position', [
]) . $this->Form->control('position', [
'label' => __d('croogo', 'Position'),
]) . $this->Form->input('address', [
]) . $this->Form->control('address', [
'label' => __d('croogo', 'Address'),
]) . $this->Form->input('address2', [
]) . $this->Form->control('address2', [
'label' => __d('croogo', 'Address2'),
]) . $this->Form->input('state', [
]) . $this->Form->control('state', [
'label' => __d('croogo', 'State'),
]) . $this->Form->input('country', [
]) . $this->Form->control('country', [
'label' => __d('croogo', 'Country'),
]) . $this->Form->input('postcode', [
]) . $this->Form->control('postcode', [
'label' => __d('croogo', 'Post Code'),
]) . $this->Form->input('phone', [
]) . $this->Form->control('phone', [
'label' => __d('croogo', 'Phone'),
]) . $this->Form->input('fax', [
]) . $this->Form->control('fax', [
'label' => __d('croogo', 'Fax'),
]);
echo $this->Html->tabEnd();

echo $this->Html->tabStart('contact-message') . $this->Form->input('message_status', [
echo $this->Html->tabStart('contact-message') . $this->Form->control('message_status', [
'label' => __d('croogo', 'Let users leave a message'),
]) . $this->Form->input('message_archive', [
]) . $this->Form->control('message_archive', [
'label' => __d('croogo', 'Save messages in database'),
]) . $this->Form->input('message_notify', [
]) . $this->Form->control('message_notify', [
'label' => __d('croogo', 'Notify by email instantly'),
]) . $this->Form->input('message_spam_protection', [
]) . $this->Form->control('message_spam_protection', [
'label' => __d('croogo', 'Spam protection (requires Akismet API key)'),
]) . $this->Form->input('message_captcha', [
]) . $this->Form->control('message_captcha', [
'label' => __d('croogo', 'Use captcha? (requires Recaptcha API key)'),
]);

Expand All @@ -79,7 +79,7 @@
$this->append('panels');
echo $this->Html->beginBox(__d('croogo', 'Publishing'));
echo $this->element('Croogo/Core.admin/buttons', ['type' => 'contact']);
echo $this->Form->input('status', [
echo $this->Form->control('status', [
'label' => __d('croogo', 'Published'),
]);
echo $this->Html->endBox();
Expand Down
12 changes: 6 additions & 6 deletions Contacts/templates/Admin/Messages/form.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,17 +23,17 @@

$this->append('tab-content');

echo $this->Html->tabStart('message-main') . $this->Form->input('name', [
echo $this->Html->tabStart('message-main') . $this->Form->control('name', [
'label' => __d('croogo', 'Name'),
]) . $this->Form->input('email', [
]) . $this->Form->control('email', [
'label' => __d('croogo', 'Email'),
]) . $this->Form->input('title', [
]) . $this->Form->control('title', [
'label' => __d('croogo', 'Title'),
]) . $this->Form->input('body', [
]) . $this->Form->control('body', [
'label' => __d('croogo', 'Body'),
]) . $this->Form->input('phone', [
]) . $this->Form->control('phone', [
'label' => __d('croogo', 'Phone'),
]) . $this->Form->input('address', [
]) . $this->Form->control('address', [
'label' => __d('croogo', 'Address'),
]);
echo $this->Html->tabEnd();
Expand Down
2 changes: 1 addition & 1 deletion Contacts/templates/Admin/Messages/index.php
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@
$this->end();

$this->start('bulk-action');
echo $this->Form->input('action', [
echo $this->Form->control('action', [
'label' => __d('croogo', 'Bulk action'),
'class' => 'c-select',
'options' => [
Expand Down
8 changes: 4 additions & 4 deletions Contacts/templates/Contacts/view.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,10 @@
<div class="contact-form">
<?php
echo $this->Form->create($message);
echo $this->Form->input('name', ['label' => __d('croogo', 'Your name')]);
echo $this->Form->input('email', ['label' => __d('croogo', 'Your email')]);
echo $this->Form->input('title', ['label' => __d('croogo', 'Subject')]);
echo $this->Form->input('body', ['label' => __d('croogo', 'Message')]);
echo $this->Form->control('name', ['label' => __d('croogo', 'Your name')]);
echo $this->Form->control('email', ['label' => __d('croogo', 'Your email')]);
echo $this->Form->control('title', ['label' => __d('croogo', 'Subject')]);
echo $this->Form->control('body', ['label' => __d('croogo', 'Message')]);
if ($contact->message_captcha) :
echo $this->Recaptcha->display();
endif;
Expand Down
2 changes: 1 addition & 1 deletion Core/src/View/Helper/FormHelper.php
Original file line number Diff line number Diff line change
Expand Up @@ -208,7 +208,7 @@ public function create($model = null, array $options = []): string
return parent::create($model, $options);
}

public function input($fieldName, array $options = [])
public function control($fieldName, array $options = [])
{
return $this->control($fieldName, $options);
}
Expand Down
8 changes: 4 additions & 4 deletions Core/templates/Bake/element/form.php
Original file line number Diff line number Diff line change
Expand Up @@ -74,27 +74,27 @@
}
if (isset($keyFields[$field])) {
%>
echo $this->Form->input('<%= $field %>', ['options' => $<%= $keyFields[$field] %>, 'empty' => true]);
echo $this->Form->control('<%= $field %>', ['options' => $<%= $keyFields[$field] %>, 'empty' => true]);
<%
continue;
}
if (!in_array($field, ['created', 'modified', 'updated'])) {
$fieldData = $schema->getColumn($field);
if (in_array($fieldData['type'], ['date', 'datetime', 'time']) && (!empty($fieldData['null']))) {
%>
echo $this->Form->input('<%= $field %>', ['empty' => true]);
echo $this->Form->control('<%= $field %>', ['empty' => true]);
<%
} else {
%>
echo $this->Form->input('<%= $field %>');
echo $this->Form->control('<%= $field %>');
<%
}
}
}
if (!empty($associations['BelongsToMany'])) {
foreach ($associations['BelongsToMany'] as $assocName => $assocData) {
%>
echo $this->Form->input('<%= $assocData['property'] %>._ids', [
echo $this->Form->control('<%= $assocData['property'] %>._ids', [
'empty' => true,
'options' => $<%= $assocData['variable'] %>,
]);
Expand Down
4 changes: 2 additions & 2 deletions Core/templates/Common/admin_edit.php
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@
else :
echo $this->Form->create($entity);
if (isset($this->getRequest()->data[$modelClass]['id'])) :
echo $this->Form->input('id');
echo $this->Form->control('id');
endif;
endif;

Expand All @@ -74,7 +74,7 @@
'tooltip' => ucfirst($field),
];
}
$content .= $this->Form->input($field, $opts);
$content .= $this->Form->control($field, $opts);
endforeach;
endif;

Expand Down
2 changes: 1 addition & 1 deletion Core/templates/Common/admin_view.php
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@
'tooltip' => ucfirst($field),
];
}
$content .= $this->Form->input($field, $opts);
$content .= $this->Form->control($field, $opts);
endforeach;
endif;
?>
Expand Down
4 changes: 2 additions & 2 deletions Core/templates/element/admin/search.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
'submitContainer' => '{{content}}',
]);
if ($this->getRequest()->getQuery('chooser')) :
echo $this->Form->input('chooser', [
echo $this->Form->control('chooser', [
'type' => 'hidden',
'value' => $this->getRequest()->getQuery('chooser'),
]);
Expand All @@ -43,7 +43,7 @@
$label = __(Inflector::humanize(Inflector::underscore($label)));
$options['placeholder'] = __d('croogo', $label);
$this->Form->unlockField($field);
echo $this->Form->input($field, $options);
echo $this->Form->control($field, $options);
}

echo $this->Form->submit(__d('croogo', 'Filter'), ['type' => 'submit', 'class' => 'btn-outline-success']);
Expand Down
2 changes: 1 addition & 1 deletion Extensions/templates/Admin/Locales/add.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
$this->end();

$this->append('tab-content');
echo $this->Html->tabStart('locales-upload') . $this->Form->input('Locale.file', [
echo $this->Html->tabStart('locales-upload') . $this->Form->control('Locale.file', [
'type' => 'file',
'class' => 'c-file'
]);
Expand Down
2 changes: 1 addition & 1 deletion Extensions/templates/Admin/Locales/edit.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@

$this->append('tab-content');
echo $this->Html->tabStart('locale-content') .
$this->Form->input('content', array(
$this->Form->control('content', array(
'label' => __d('croogo', 'Content'),
'data-placement' => 'top',
'value' => $content,
Expand Down
2 changes: 1 addition & 1 deletion Extensions/templates/Admin/Plugins/add.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
$this->end();

$this->append('tab-content');
echo $this->Html->tabStart('plugins-upload') . $this->Form->input('Plugin.file', [
echo $this->Html->tabStart('plugins-upload') . $this->Form->control('Plugin.file', [
'type' => 'file',
'class' => 'c-file',
'required' => true,
Expand Down
2 changes: 1 addition & 1 deletion Extensions/templates/Admin/Themes/add.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
$this->end();

$this->append('tab-content');
echo $this->Html->tabStart('themes-upload') . $this->Form->input('Theme.file', [
echo $this->Html->tabStart('themes-upload') . $this->Form->control('Theme.file', [
'type' => 'file',
'class' => 'c-file',
'required' => true,
Expand Down
Loading

0 comments on commit 41e51d7

Please sign in to comment.