You are here

protected function context_reaction_block::is_editable in Context 6.3

Same name and namespace in other branches
  1. 6 plugins/context_reaction_block.inc \context_reaction_block::is_editable()

Determine whether inline editing requirements are met and that the current user may edit.

2 calls to context_reaction_block::is_editable()
context_reaction_block::block_list in plugins/context_reaction_block.inc
An alternative version of block_list() that provides any context enabled blocks.
context_reaction_block::execute in plugins/context_reaction_block.inc
Execute.

File

plugins/context_reaction_block.inc, line 228

Class

context_reaction_block
Expose blocks as context reactions.

Code

protected function is_editable($reset = FALSE) {

  // Check requirements.
  // Generally speaking, it does not make sense to allow anonymous users to
  // edit a context inline. Though it may be possible to save (and restore)
  // an edited context to an anonymous user's cookie or session, it's an
  // edge case and probably not something we want to encourage anyway.
  static $editable;
  if (!isset($editable) || $reset) {
    global $user;
    if (module_exists('jquery_ui') && $user->uid) {
      $editable = TRUE;
      jquery_ui_add(array(
        'ui.draggable',
        'ui.droppable',
        'ui.sortable',
      ));
      drupal_add_js(drupal_get_path('module', 'context') . '/plugins/context_reaction_block.js');
      drupal_add_css(drupal_get_path('module', 'context') . '/plugins/context_reaction_block.css');
    }
    else {
      $editable = FALSE;
    }
  }
  return $editable;
}