From e72cf26f26b1fc8ee26368309c4f49a29d8c7b0a Mon Sep 17 00:00:00 2001 From: Peter Thaleikis Date: Thu, 26 Nov 2015 14:05:41 +1300 Subject: [PATCH 1/3] Update README.md fixing the examples --- README.md | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) diff --git a/README.md b/README.md index e16979d..948cac0 100644 --- a/README.md +++ b/README.md @@ -24,18 +24,20 @@ A Link Object can be linked to a URL or, an internal Page or File in the SilverS ### Example usage ```php -class Page extends SiteTree{ +class Page extends SiteTree { - static $has_one = array( + private static $has_one = array( 'ExampleLink' => 'Link' ); public function getCMSFields(){ $fields = parent::getCMSFields(); + $fields->addFieldToTab('Root.Link', LinkField::create('ExampleLinkID', 'Link to page or file')); + + return $fields; } - - ... +} ``` In your template, you can render the links anchor tag with @@ -57,18 +59,20 @@ Use the EmbeddedObject/Field to easily add oEmbed content to a DataObject or Pag ### Example usage ```php -class Page extends SiteTree{ +class Page extends SiteTree { - static $has_one = array( + private static $has_one = array( 'Video' => 'EmbeddedObject' ); public function getCMSFields(){ $fields = parent::getCMSFields(); + $fields->addFieldToTab('Root.Video', EmbeddedObjectField::create('Video', 'Video from oEmbed URL', $this->Video())); + return $fields; } - +} ... ``` From 14f8bfb8959c2c019272501558ebe9d4046eef62 Mon Sep 17 00:00:00 2001 From: Myles Beardsmore Date: Thu, 26 Nov 2015 14:47:26 +1300 Subject: [PATCH 2/3] Added extension point to customise link template. --- code/dataobjects/Link.php | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/code/dataobjects/Link.php b/code/dataobjects/Link.php index 2043b0b..ba49190 100644 --- a/code/dataobjects/Link.php +++ b/code/dataobjects/Link.php @@ -168,7 +168,12 @@ public function forTemplate() { $title = $this->Title ? $this->Title : $url; // legacy $target = $this->getTargetAttr(); $class = $this->getClassAttr(); - return "$title"; + + $link = "$title"; + + $this->extend('updateLinkTemplate', $this, $link); + + return $link; } } From 45e5ff3e41fe44a1734b471f36f5f719fb607a4b Mon Sep 17 00:00:00 2001 From: Shea Dawson Date: Mon, 14 Dec 2015 11:14:14 +1300 Subject: [PATCH 3/3] Allow installation with ss 3.3 fixes #37 --- composer.json | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/composer.json b/composer.json index eca4f87..155c3d6 100644 --- a/composer.json +++ b/composer.json @@ -17,9 +17,9 @@ ], "require": { "php": ">=5.3.2", - "silverstripe/framework": "3.2.*", - "silverstripe/cms": "3.2.*", - "unclecheese/display-logic": "1.3.*", + "silverstripe/framework": "^3.2", + "silverstripe/cms": "^3.2", + "unclecheese/display-logic": "^1", "embed/embed": "~2.2.2" }, "extra": {