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

Update for Symphony 4.x #17

Open
wants to merge 15 commits into
base: master
Choose a base branch
from
Open
25 changes: 0 additions & 25 deletions assets/publish.link_preview.css

This file was deleted.

14 changes: 7 additions & 7 deletions assets/publish.link_preview.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,24 +13,24 @@
var FIELD = 'field-link_preview';
var FIELD_CLASS = '.' + FIELD;
var target = $();

var hookOne = function (index, elem) {
elem = $(elem);

var url = elem.attr('data-url');
var text = elem.attr('data-text');
if (!!url) {

if (!!url && url != '') {
var li = $('<li />'),
link = $('<a />')
.text(text)
.html('<svg version="1.1" xmlns="http://www.w3.org/2000/svg" width="33.7px" height="19.3px" viewBox="0 0 33.7 19.3"><path fill="currentColor" d="M16.8,19.3c-9.1,0-16.3-8.7-16.6-9c-0.3-0.4-0.3-0.9,0-1.3c0.3-0.4,7.5-9,16.6-9s16.3,8.7,16.6,9c0.3,0.4,0.3,0.9,0,1.3C33.2,10.7,26,19.3,16.8,19.3z M2.3,9.7c1.8,1.9,7.7,7.7,14.5,7.7c6.8,0,12.7-5.7,14.5-7.7C29.6,7.7,23.7,2,16.8,2C10,2,4.1,7.7,2.3,9.7z"/><path fill="currentColor" d="M16.8,15.3c-3.1,0-5.6-2.5-5.6-5.6c0-3.1,2.5-5.6,5.6-5.6s5.6,2.5,5.6,5.6C22.5,12.8,20,15.3,16.8,15.3zM16.8,6c-2,0-3.6,1.6-3.6,3.6s1.6,3.6,3.6,3.6s3.6-1.6,3.6-3.6S18.9,6,16.8,6z"/></svg><span><span>'+text+'</span></span>')
.attr('class', 'button drawer vertical-right link-preview')
.attr('href', url)
.attr('target', '_blank');

li.append(link);

target.append(li);
target.prepend(li);
}
};

Expand All @@ -45,4 +45,4 @@

$(init);

})(jQuery);
})(jQuery);
25 changes: 9 additions & 16 deletions extension.driver.php
Original file line number Diff line number Diff line change
Expand Up @@ -52,14 +52,7 @@ public function appendResources(Array $context) {

// publish page, new or edit
if(isset($c['context']['section_handle']) && in_array($c['context']['page'], array('new', 'edit'))){

Administration::instance()->Page->addStylesheetToHead(
URL . '/extensions/link_preview/assets/publish.link_preview.css',
'screen',
time(),
false
);


Administration::instance()->Page->addScriptToHead(
URL . '/extensions/link_preview/assets/publish.link_preview.js',
time() + 1,
Expand All @@ -69,22 +62,22 @@ public function appendResources(Array $context) {
return;
}
}


/* ********* INSTALL/UPDATE/UNINSTALL ******* */

/**
* Creates the table needed for the settings of the field
*/
public function install() {
return FieldLink_Preview::createFieldTable();
}

/**
* Creates the table needed for the settings of the field
*/
public function update($previousVersion = false) {

$ret = true;

// are we updating from lower than 1.2 ?
Expand All @@ -95,15 +88,15 @@ public function update($previousVersion = false) {
// set the return value
$ret = $ret_anchor && $ret_display;
}

// are we updating from lower than 1.3.0 ?
if ($ret && version_compare($previousVersion,'1.3.0') < 0) {
$ret = FieldLink_Preview::updateFieldTable_DisplayNew();
}

return true;
}

/**
*
* Drops the table needed for the settings of the field
Expand Down
7 changes: 6 additions & 1 deletion extension.meta.xml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<extension id="link_preview" status="released" xmlns="http://getsymphony.com/schemas/extension/1.0">
<name>Link Preview</name>
<name>Field: Link Preview</name>
<description>
Offers a field that will place a link to the frontend in the publish pages
</description>
Expand All @@ -20,6 +20,11 @@
<!-- None -->
</dependencies>
<releases>
<release version="2.0.0" date="TBA" min="4.0.0" max="4.x.x" php-min="5.6.x" php-max="7.x.x">
- Update for Symphony 4.x
- Code refactoring for Database and EQFA
- Replace deprecated method fetch() by select()
</release>
<release version="1.4.0" date="2017-10-10" min="2.3.4" max="2.x.x">
- Add support for multilingual select box link
</release>
Expand Down
Loading