Skip to main content
1 of 3

Custom Form Block not displaying

I'm trying to create a custom form displayed inside of a block.

Here is my code:

<?php
/*
 * Creating custom form to edit/delete nodes
 */
function custom_block_settings_form($form, &$form_state){
    $form['node-id'] = array(
        '#type' => 'textfield',
        '#title' => 'Node Number',
        '#maxlength' => 15,
        '#size' => 15,
        '#required' => TRUE,
    );
    $form['edit-delete'] = array(
        '#type' => 'radios',
        '#options' => array('edit' => 'Edit', 'delete' => 'Delete'),
        '#required' => TRUE,
    );
    $form['save'] = array(
        '#type' => 'submit',
        '#value' => 'Submit',
        '#submit' => array('custom_block_form_submit'),
        '#validate' => array('custom_block_form_validate'),
    );
    return $form;
}
/*
 * running validation on the form to verify node id is correct
 *
 */

function custom_block_settings_form_validate($form, &$form_state, &$node){
    if (($node->nid) != ($form_state['value']['node-id']));
        form_set_error('node-id', 'Please enter a valid node-id');
}
/*
 * Create block
 */
function custom_block_settings_block_info(){
    $blocks = array();
    $blocks['custom_block_settings'] = array(
        'info' => t('Custom block'),
        'region' => 'sidebar_second',
        'status' => TRUE,
        'visibility' => BLOCK_VISIBILITY_LISTED,
        'pages' => variable_get('hospitalist-schedule', NULL),
    );
    return $blocks;
}

function custom_block_settings_block_view($delta = ''){
    $block =- array();
    switch ($delta) {
        case 'custom_block_delete':
        $block['subject'] = t('Custom Block');
        $block['content'] = drupal_get_form('custom_block_settings_form');
        break;
    }
    return $block;
}

I also have ran drush block-show to see if the block has shown up"(ref: Registered custom block not showing up):

 Module                Delta                            Region          Weight
 block                 4                                sidebar_second  0
 block                 1                                -1              0
 block                 2                                -1              0
 block                 3                                -1              0
 backup_migrate        quick_backup                     -1              0
 calendar              calendar_legend                  -1              0
 comment               recent                           -1              0
 context_ui            editor                           -1              0
 context_ui            devel                            -1              0
 fullcalendar_legend   fullcalendar_legend              -1              0
 logintoboggan         logintoboggan_logged_in          -1              0
 menu                  devel                            -1              0
 node                  syndicate                        -1              0
 node                  recent                           -1              0
 search                form                             -1              -1
 shortcut              shortcuts                        -1              0
 system                main                             content         0
 system                powered-by                       -1              10
 system                help                             help            0
 system                navigation                       -1              0
 system                management                       -1              0
 system                user-menu                        -1              0
 system                main-menu                        -1              0
 user                  login                            -1              0
 user                  new                              -1              0
 user                  online                           -1              0
 views                 hospitalist_schedule-block       -1              0
 views                 hospitalist_on_call_today-block  sidebar_second  0
 views                 admitting_hospitalist-block      sidebar_second  0
 views                 -exp-all_assets-page             -1              0
 views                 calendar-block_1                 -1              0
 views                 calendar-block_2                 -1              0
 views                 -exp-form_view-page              -1              0
 devel                 execute_php                      -1              0
 devel                 switch_user                      -1              0
 custom_search_blocks  1

But I don't see my block, I have ran drush cc all multiple times, I have even went so far as to reboot my webserver to see if that would catch it. But, I still don't see the block. tia