You are here

interface CommerceLicenseInterface in Commerce License 7

Ensures basic required behavior for a license.

EntityBundlePluginProvideFieldsInterface also mandates a fields() method.

Hierarchy

Expanded class hierarchy of CommerceLicenseInterface

All classes that implement CommerceLicenseInterface

File

includes/plugins/license_type/base.inc, line 18
Abstract and interface plugin implementation.

View source
interface CommerceLicenseInterface extends EntityBundlePluginProvideFieldsInterface {

  /**
   * Returns an html representation of the access details.
   *
   * The information contained within should be the required minimum
   * for the customer to access the resource he purchased the rights to.
   *
   * If the customer purchased a file license, this method would output
   * the link to that file.
   * If the customer purchased a software subscription and the service
   * returned access credentials, this method would return those
   * access credentials.
   *
   * @return
   *   An html string with the access details.
   */
  public function accessDetails();

  /**
   * Returns whether a license is configurable.
   *
   * Configurable licenses are editable by the customer, either through
   * the add to cart form (via Inline Entity Form) or through a checkout pane.
   *
   * The output of this method determines whether form(), formValidate()
   * and formSubmit() will be called.
   *
   * @return
   *   TRUE if the license is configurable, FALSE otherwise.
   */
  public function isConfigurable();

  /**
   * Provides the license form.
   *
   * @param $form
   *   The license form. Might be embedded in another form through
   *   Inline Entity Form.
   * @param $form_state
   *   The form state of the complete form.
   *   Always use drupal_array_get_nested_value() instead of accessing
   *   $form_state['values'] directly.
   */
  public function form(&$form, &$form_state);

  /**
   * Validates the license form.
   *
   * @param $form
   *   The license form. Might be embedded in another form through
   *   Inline Entity Form, so form['#parents'] needs to be taken into account
   *   when fetching values and setting errors.
   * @param $form_state
   *   The form state of the complete form.
   *   Always use drupal_array_get_nested_value() instead of accessing
   *   $form_state['values'] directly.
   */
  public function formValidate($form, &$form_state);

  /**
   * Submits the license form.
   *
   * @param $form
   *   The license form. Might be embedded in another form through
   *   Inline Entity Form, so form['#parents'] needs to be taken into account
   *   when fetching values and setting errors.
   * @param $form_state
   *   The form state of the complete form.
   *   Always use drupal_array_get_nested_value() instead of accessing
   *   $form_state['values'] directly.
   */
  public function formSubmit(&$form, $form_state);

  /**
   * Returns the html message to be shown to the customer on checkout complete.
   *
   * Called by the commerce_license_complete checkout pane.
   *
   * @return
   *   The html message to be shown to the customer.
   */
  public function checkoutCompletionMessage();

  /**
   * Activates the license.
   */
  public function activate();

  /**
   * Expires the license.
   */
  public function expire();

  /**
   * Suspends the license.
   */
  public function suspend();

  /**
   * Revokes the license.
   */
  public function revoke();

  /**
   * Renews the license.
   *
   * @param $expires
   *   The new expiration timestamp.
   */
  public function renew($expires);

}

Members

Namesort descending Modifiers Type Description Overrides
CommerceLicenseInterface::accessDetails public function Returns an html representation of the access details. 1
CommerceLicenseInterface::activate public function Activates the license. 1
CommerceLicenseInterface::checkoutCompletionMessage public function Returns the html message to be shown to the customer on checkout complete. 1
CommerceLicenseInterface::expire public function Expires the license. 1
CommerceLicenseInterface::form public function Provides the license form. 1
CommerceLicenseInterface::formSubmit public function Submits the license form. 1
CommerceLicenseInterface::formValidate public function Validates the license form. 1
CommerceLicenseInterface::isConfigurable public function Returns whether a license is configurable. 1
CommerceLicenseInterface::renew public function Renews the license. 1
CommerceLicenseInterface::revoke public function Revokes the license. 1
CommerceLicenseInterface::suspend public function Suspends the license. 1
EntityBundlePluginProvideFieldsInterface::fields static function Returns the fields that are going to be used by this entity bundle. 2