Exemplo n.º 1
0
 /**
  * Post a Tweet about article node
  *
  * @param Node $node Node
  * @return array $statuses Result of posting a Tweet
  */
 public function tweetAboutArticle(Node $node)
 {
     // Set absolute URL to the node
     $url = $node->url('canonical', ['absolute' => true]);
     //$node->get('tags');
     $tweet = $this->createTweet($node->getTitle(), $url);
     // $statuses = $this->getApi()->post("statuses/update", ["status" => $tweet]);
     //print_r($statuses); exit;
     $statuses = [];
     return $statuses;
 }
Exemplo n.º 2
0
 /**
  * Helper function to return a sanitized node title.
  */
 private static function get_node_title(Node $node)
 {
     if (isset($node)) {
         $nid = $node->id();
         if ($node_title = $node->getTitle()) {
             return $node_title;
         } elseif ($nid) {
             return $nid;
         }
     }
     return '—';
 }