In my custom module I am trying to extend RulesDataUI class as below in the code which works fine just after clearing the caches, but on the next page reload I get warning as "Warning: class_implements(): Class RulesDataUICheckboxes does not exist and could not be loaded". I am not getting a clue how the class functions are invoked only just after cache clear.

The below code is present in my module name.rules.inc(nodequeue_rules.rules.inc)

 function nodequeue_rules_rules_data_info() {
      $return = array(
        'checkboxes' => array(
          'label' => t('checkboxes'),
          'ui class' => 'RulesDataUICheckboxes',
          'token type' => 'rules_text',
      return $return;

class RulesDataUICheckboxes extends RulesDataUI implements RulesDataDirectInputFormInterface {
  public static function getDefaultMode() {
    return 'input';
  public static function inputForm($name, $info, $settings, RulesPlugin $element) {
    if (!empty($info['options list'])) {  
      // Make sure the .rules.inc of the providing module is included as the
      // options list callback may reside there.
      $form[$name] = array(
        '#type' => 'checkboxes',
        '#options' => call_user_func($info['options list'], $element, $name),
    else {
      $form[$name] = array(
        '#type' => 'textarea',
      RulesDataInputEvaluator::attachForm($form, $settings, $info, $element->availableVariables());
        $settings += array($name => isset($info['default value']) ? $info['default value'] : NULL);
    $form[$name] += array(
      '#title' => t('Value'),
      '#default_value' => $settings[$name],
      '#required' => empty($info['optional']),
      '#after_build' => array('rules_ui_element_fix_empty_after_build'),
      '#rows' => 3,
    return $form;
    public static function render($value) {
    return array(
      'content' => array('#markup' => check_plain($value)),
      '#attributes' => array('class' => array('rules-parameter-text')),

I think you need to add your rules.inc file to the info files[] array to ensure that the file is included while rebuilding the UI.

See more related: https://www.drupal.org/node/1275958 & https://www.drupal.org/node/1276606


It would be the problem that modulename.rules.inc invoked (or included) just to get all rules hooks. Worth trying to add the class definition in separate file (e.g. includes/rules_ui.inc) and include in nodequeue_rules.info file as

files[] = includes/rules_ui.inc

  • Thanks @vijay, yeah the ..rules.inc file was getting included for first time as due to other rules hook implemented and then once hooks were cached there was no way to include the class. Thanks again for your detailed answer :), I wish I can accept both the answers here.
    – arpitr
    Jul 6 '14 at 20:29

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.