Tag Archives: php

Drupal Comment Field

I have been using this field in  a recent project needed to migrate data to it. No migrate handler existed so I created one. Probably the easiest five minutes I have used to program Drupal.

I have submitted it too https://www.drupal.org/node/2541912

But for those looking to migrate to this field use this code

 

<?php
class MigrateCommentFieldHandler extends MigrateFieldHandler {

  public function __construct() {
    $this->registerTypes(array('commentfield'));
  }

  public function prepare($entity, array $field_info, array $instance, array $values) {
    // Setup the Field API array for saving.
    $arguments = (isset($values['arguments'])) ? $values['arguments']: array();
    $language = $this->getFieldLanguage($entity, $field_info, $arguments);
    $delta = 0;
    foreach ($values as $value) {
      $return[$language][$delta]['comment'] = $value['comment'];
      $return[$language][$delta]['created'] = $value['created'];
      $return[$language][$delta]['uid']     = $value['uid'];
      $delta++;
    }
    return isset($return) ? $return : NULL;
  }
}
?>

 

Share with your friends
  • Twitter
  • Facebook
  • email

All the different Lorem Ipsum Generators

Lorem Ipsum is what programmers know as dummy or filler text when creating content for a web page or print media. It is used to populate the body of a node which forms part of some form of content such as a webpage, news article, blog etc.

A developers most hated job after fixing bugs is populating content. This can be automated via many different means how ever a lot of the time a field just needs to have content because it is not allowed to be blank. This enables developers to see how the output will get rendered for the general public and also may populate things such as a search index or a excerpt list of content.

The most commonly known Lorem Ipsum generator is http://www.lipsum.com/. an example of what we are talking about here can be found below.

 Lorem ipsum dolor sit amet, consectetur adipiscing elit. Fusce pretium mollis ipsum eu molestie. Ut quis est in purus tristique ullamcorper. Aliquam eget felis mauris. Donec placerat justo ac faucibus scelerisque. Aliquam elementum pulvinar mi, ac interdum libero malesuada et. Fusce pellentesque lacus ut tellus tincidunt euismod. Suspendisse potenti. Integer id consequat ligula. Morbi vel urna a est varius dignissim. Aenean mattis venenatis mollis. Suspendisse mattis laoreet ante, sed sagittis quam dictum ut.

Below is a list of different Lorem Ipsum generators I have had bookmarked in the past and ones I have found writing this post.

Here are some I just haven’t used and probably would not

A good index of these sorts of sites is at http://chooseyouripsum.com/ If you have more of your own add them to the comments below.

Share with your friends
  • Twitter
  • Facebook
  • email