You are here

class facebook_pull_box in Facebook Pull 7

Same name and namespace in other branches
  1. 6 plugins/facebook_pull_box.inc \facebook_pull_box
  2. 7.3 plugins/facebook_pull_box.inc \facebook_pull_box
  3. 7.2 plugins/facebook_pull_box.inc \facebook_pull_box

Boxes plugin for the Facebook Pull module.

Hierarchy

Expanded class hierarchy of facebook_pull_box

1 string reference to 'facebook_pull_box'
facebook_pull_boxes_plugins in ./facebook_pull.module
Implementation of hook_boxes_plugins().

File

plugins/facebook_pull_box.inc, line 6

View source
class facebook_pull_box extends boxes_box {

  /**
   * Implementation of boxes_content::options_defaults().
   */
  public function options_defaults() {
    return array(
      'app_id' => variable_get('facebook_pull_app_id', ''),
      'app_secret' => variable_get('facebook_pull_app_secret', ''),
      'graph_id' => variable_get('facebook_pull_graph_id', ''),
      'object_type' => variable_get('facebook_pull_object_type', ''),
      'limit' => variable_get('facebook_pull_limit', ''),
    );
  }

  /**
   * Implementation of boxes_content::options_form().
   */
  public function options_form(&$form_state) {
    $form = array();
    $application_id = l(t('Application ID'), 'https://developers.facebook.com/apps');
    $form['app_id'] = array(
      '#type' => 'textfield',
      '#title' => t('App ID'),
      '#default_value' => $this->options['app_id'],
      '#description' => t('Unique !application_id for your facebook app.', array(
        '!application_id' => $application_id,
      )),
    );
    $form['app_secret'] = array(
      '#type' => 'textfield',
      '#title' => t('App Secret'),
      '#default_value' => $this->options['app_secret'],
      '#description' => t('Your sites app secret.'),
    );
    $graph_link = l(t('Graph ID'), 'http://developers.facebook.com/docs/reference/api/');
    $form['graph_id'] = array(
      '#type' => 'textfield',
      '#title' => t('Graph ID'),
      '#default_value' => $this->options['graph_id'],
      '#description' => t('The !graph_id of the page, user, or group.', array(
        '!graph_id' => $graph_link,
      )),
    );
    $form['object_type'] = array(
      '#type' => 'textfield',
      '#title' => t('Object type'),
      '#default_value' => $this->options['object_type'],
      '#description' => t('The object type to pull, e.g. friends, feed, photos.'),
    );
    $form['limit'] = array(
      '#type' => 'textfield',
      '#title' => t('Limit'),
      '#size' => 5,
      '#default_value' => $this->options['limit'],
      '#description' => t('How many posts to show in the box by default. If you have not entered a default limit here then it will default to 10.'),
    );
    return $form;
  }

  /**
   * Implementation of boxes_content::options_form().
   */
  public function render() {
    $content = facebook_pull_render($this->options['graph_id'], $this->options['object_type'], $this->options['app_id'], $this->options['app_secret'], array(
      'limit' => $this->options['limit'],
    ));
    $title = isset($this->title) ? check_plain($this->title) : NULL;
    return array(
      'delta' => $this->delta,
      'title' => $title,
      'subject' => $title,
      'content' => $content,
    );
  }

}

Members

Namesort descending Modifiers Type Description Overrides
boxes_box::$boxes static property
boxes_box::$delta public property
boxes_box::$description public property
boxes_box::$export_type public property
boxes_box::$new public property
boxes_box::$options public property
boxes_box::$plugin_key public property
boxes_box::$title public property
boxes_box::cache_setting public function Returns the block cache settings for this box. Subclasses can override this to perform more intricate operations around deciding the cache settings of the specific box instance.
boxes_box::delete public function Delete a box.
boxes_box::factory public static function Instantiate, populate and return a box object.
boxes_box::load public static function Load existing box by its unique identifier $delta.
boxes_box::reset public static function Reset the boxes cache.
boxes_box::save public function Save a box.
boxes_box::use_multistep_create public function Declare if the box should use a multistep form for the create form.
boxes_box::__construct protected function Create a new box.
facebook_pull_box::options_defaults public function Implementation of boxes_content::options_defaults(). Overrides boxes_box::options_defaults
facebook_pull_box::options_form public function Implementation of boxes_content::options_form(). Overrides boxes_box::options_form
facebook_pull_box::render public function Implementation of boxes_content::options_form(). Overrides boxes_box::render