Skip to content

Commit

Permalink
Fix multi_tag_field
Browse files Browse the repository at this point in the history
- Database update needed $previousVersion = false
- Database install needed a NOT NULL in def_ref_lang
- Needed to add params to fit the parent methods

New release
  • Loading branch information
ChoboHub authored and nitriques committed Mar 22, 2017
1 parent 4de04c8 commit cf6cdc5
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 8 deletions.
4 changes: 2 additions & 2 deletions extension.driver.php
Expand Up @@ -28,15 +28,15 @@ public function install(){
`field_id` int(11) unsigned NOT NULL,
`validator` varchar(50),
`pre_populate_source` varchar(15),
`def_ref_lang` enum('yes','no') default 'no',
`def_ref_lang` enum('yes','no') NOT NULL default 'no',
PRIMARY KEY (`id`),
KEY `field_id` (`field_id`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;",
self::FIELD_TABLE
));
}

public function update($prev_version){
public function update($previousVersion = false){
if( version_compare($prev_version, '1.2', '<') ){
Symphony::Database()->query(sprintf(
"RENAME TABLE `tbl_fields_multilingualtag` TO `%s`;",
Expand Down
7 changes: 6 additions & 1 deletion extension.meta.xml
Expand Up @@ -28,6 +28,11 @@
<dependency version="1.5">https://github.com/vlad-ghita/frontend_localisation</dependency>
</dependencies>
<releases>
<release version="1.2.2" date="2016-08-04" min="2.3" max="2.x.x"><![CDATA[
* Supported on PHP 7.
* Fixed parameter to fit the parent method.
* Fixed database install and update.
]]></release>
<release version="1.2.1" date="2016-05-18" min="2.3" max="2.x.x"><![CDATA[
* Various bug fixes.
]]></release>
Expand All @@ -40,7 +45,7 @@
* General clean-up.
]]></release>
<release version="1.0" date="2012-03-28" min="2.2"><![CDATA[
* Initial release
* Initial release.
]]></release>
</releases>
</extension>
10 changes: 5 additions & 5 deletions fields/field.multilingual_tag.php
Expand Up @@ -51,7 +51,7 @@ public function createTable(){
/* Settings */
/*------------------------------------------------------------------------------------------------*/

public function findDefaults(&$settings){
public function findDefaults(array &$settings){
if( $settings['def_ref_lang'] != 'yes' ){
$settings['def_ref_lang'] = 'no';
}
Expand Down Expand Up @@ -94,7 +94,7 @@ public function commit(){
/* Publish */
/*------------------------------------------------------------------------------------------------*/

public function displayPublishPanel(XMLElement &$wrapper, $data = NULL, $flagWithError = NULL, $fieldnamePrefix = NULL, $fieldnamePostfix = NULL){
public function displayPublishPanel(XMLElement &$wrapper, $data = NULL, $flagWithError = NULL, $fieldnamePrefix = NULL, $fieldnamePostfix = NULL, $entry_id = NULL){

// We've been called out of context: Pulblish Filter
$callback = Administration::instance()->getPageCallback();
Expand Down Expand Up @@ -220,7 +220,7 @@ public function checkPostFieldData($data, &$message, $entry_id = NULL){
return $error;
}

public function processRawFieldData($data, &$status, &$message, $simulate = false, $entry_id = NULL){
public function processRawFieldData($data, &$status, &$message = NULL, $simulate = false, $entry_id = NULL){
if( !is_array($data) || empty($data) ) return parent::processRawFieldData($data, $status, $simulate, $entry_id);

$result = array();
Expand Down Expand Up @@ -262,7 +262,7 @@ public function processRawFieldData($data, &$status, &$message, $simulate = fals
/* Output */
/*------------------------------------------------------------------------------------------------*/

public function appendFormattedElement(XMLElement &$wrapper, $data){
public function appendFormattedElement(XMLElement &$wrapper, $data, $encode = false, $mode = NULL, $entry_id = NULL){
$lang_code = FLang::getLangCode();

// If called without language_code (search_index) return values of all languages
Expand Down Expand Up @@ -294,7 +294,7 @@ public function prepareTableValue($data, XMLElement $link = NULL, $entry_id = nu
return parent::prepareTableValue($data, $link, $entry_id);
}

public function getParameterPoolValue($data){
public function getParameterPoolValue(array $data, $entry_id = NULL){
return $this->__clearEmtpyTags($data['value-'.FLang::getMainLang()]);
}

Expand Down

0 comments on commit cf6cdc5

Please sign in to comment.