You are here

function Notifications_Subscription::is_editable in Notifications 7

Same name and namespace in other branches
  1. 6.4 includes/notifications_subscription.class.inc \Notifications_Subscription::is_editable()

Whether this subscription's fields are editable or not

Unless preset the 'editable' property, this is how it works:

  • Once we have an instance we don't allow changing the fields, which may cause some consistency problems
  • Also if the subscription type has no fields, this is not editable
  • When it has fields and they've been all preset, not editable either

File

./notifications.subscription.inc, line 1365
Drupal Notifications Framework - Default class file

Class

Notifications_Subscription
Common base for subscription type and subscription instance

Code

function is_editable() {
  if (!isset($this->editable)) {
    if (!$this
      ->is_instance() && ($type_fields = $this
      ->get_type_fields())) {

      // It is editable if not all fields are set
      $this->editable = count($type_fields) > count($this
        ->get_instance_fields());
    }
    else {

      // It is instance or the type has no fields
      $this->editable = FALSE;
    }
  }
  return $this->editable;
}