summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authoradrianopulz2016-04-09 01:37:28 -0700
committermicropat2016-04-09 01:37:28 -0700
commitc7d091abd767a81c0785dac84890985278c73f37 (patch)
treea047ecebd9c7726f9ca83c867ec7def10f5b75f6
parentb894bcaa201b13bb840016f43747685e7f548e9f (diff)
Issue #2664160 by adrianopulz: Display Suite support8.x-1.3
-rw-r--r--src/Plugin/DsField/AddToAnyField.php35
1 files changed, 35 insertions, 0 deletions
diff --git a/src/Plugin/DsField/AddToAnyField.php b/src/Plugin/DsField/AddToAnyField.php
new file mode 100644
index 0000000..8a25f7f
--- /dev/null
+++ b/src/Plugin/DsField/AddToAnyField.php
@@ -0,0 +1,35 @@
+<?php
+
+/**
+ * @file
+ * Contains \Drupal\ds\Plugin\DsField\DsFieldBase.
+ */
+
+namespace Drupal\addtoany\Plugin\DsField;
+use Drupal\ds\Plugin\DsField\DsFieldBase;
+
+/**
+ * Plugin that renders the AddToAny Buttons as Display Suite Field.
+ *
+ * @DsField(
+ * id = "addtoany_field",
+ * title = @Translation("AddToAny Buttons"),
+ * entity_type = "node",
+ * provider = "addtoany",
+ * ui_limit = {"*|*"}
+ * )
+ */
+class AddToAnyField extends DsFieldBase {
+
+ /**
+ * {@inheritdoc}
+ */
+ public function build() {
+ $node = \Drupal::routeMatch()->getParameter('node');
+
+ return array(
+ '#theme' => 'addtoany_standard',
+ '#addtoany_html' => addtoany_create_node_buttons($node),
+ );
+ }
+}