Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix email field #4

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 13 additions & 1 deletion extension.driver.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,21 @@ public function install(){
CREATE TABLE `tbl_fields_email` (
`id` int(11) unsigned NOT NULL auto_increment,
`field_id` int(11) unsigned NOT NULL,
`validator` varchar(255) default NULL,
PRIMARY KEY (`id`),
KEY `field_id` (`field_id`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
");
}
}

public function update($previousVersion = false){

if (version_compare($previousVersion, '1.2.2', '<=')) {
Symphony::Database()->query(
"ALTER TABLE `tbl_fields_email`
ADD COLUMN `validator` varchar(255) default NULL;"
);
}

}
}
5 changes: 5 additions & 0 deletions extension.meta.xml
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,11 @@
</author>
</authors>
<releases>
<release version="1.2.2" date="2016-08-15" min="2.3">
- Supported on PHP 7
- Added update for older version
- Fixed install missing validator
</release>
<release version="1.2.1" date="2013-02-25" min="2.3">
- Minor updates to method signatures for forward compatibility
</release>
Expand Down
12 changes: 9 additions & 3 deletions fields/field.email.php
Original file line number Diff line number Diff line change
Expand Up @@ -50,9 +50,15 @@ private function __applyValidationRule($data) {
public function displaySettingsPanel(XMLElement &$wrapper, $errors = null) {
parent::displaySettingsPanel($wrapper, $errors);

if ($this->get('id')) {
$wrapper->removeChildAt(5);
$wrapper->removeChildAt(4);
} else {
$wrapper->removeChildAt(4);
$wrapper->removeChildAt(3);
}
$div = new XMLElement('div', NULL, array('class' => 'two columns'));
$this->appendRequiredCheckbox($div);
$this->appendShowColumnCheckbox($div);

$wrapper->appendChild($div);
}

Expand All @@ -64,7 +70,7 @@ public function commit(){

$fields = array();
$fields['field_id'] = $id;

return FieldManager::saveSettings($id, $fields);
}

Expand Down