You are here

function fasttoggle_node_fasttoggle_available_links in Fasttoggle 7

Same name in this branch
  1. 7 fasttoggle.api.php \fasttoggle_node_fasttoggle_available_links()
  2. 7 module/fasttoggle_node/fasttoggle_node.module \fasttoggle_node_fasttoggle_available_links()

Implements hook_fasttoggle_labels().

File

module/fasttoggle_node/fasttoggle_node.module, line 144

Code

function fasttoggle_node_fasttoggle_available_links($type = NULL, $obj = NULL) {
  if (!is_null($type) && $type != 'node') {
    return array();
  }
  $result = array(
    'node' => array(
      'id_field' => 'nid',
      'title_field' => 'title',
      'save_fn' => 'fasttoggle_node_save',
      'object_type' => 'node',
      'subtype_field' => 'type',
      'access' => array(
        'fasttoggle_node_edit_access',
      ),
      'global_settings_desc' => t('In addition to these global settings, you need to enable fasttoggle in the settings page for each content type you wish to use.'),
      'nodetype_settings_desc' => t('In addition to these settings, you need to enable the sitewide setting for toggles you want to use.'),
      'extra_settings' => array(
        'help_text' => array(
          '#value' => t('Configure access restrictions for these settings on the <a href="@url">access control</a> page.', array(
            '@url' => url('admin/user/permissions', array(
              'fragment' => 'module-fasttoggle',
            )),
          )),
          '#prefix' => '<div>',
          '#suffix' => '</div>',
        ),
        'fasttoggle_enhance_node_overview_page' => array(
          '#type' => 'checkbox',
          '#title' => t('Add published/unpublished toggle links to the node overview page.'),
          '#default_value' => variable_get('fasttoggle_enhance_node_overview_page', TRUE),
          '#weight' => 50,
        ),
      ),
      'fields' => array(
        'status' => array(
          'display' => array(
            'node_links',
          ),
          'instances' => array(
            'status' => array(
              'description' => t('Status <small>(published/unpublished)</small>'),
              'access' => array(
                'fasttoggle_node_status_access',
              ),
              'labels' => array(
                FASTTOGGLE_LABEL_ACTION => array(
                  0 => t('publish'),
                  1 => t('unpublish'),
                ),
                FASTTOGGLE_LABEL_STATUS => array(
                  0 => t('not published'),
                  1 => t('published'),
                ),
              ),
            ),
            'sticky' => array(
              'description' => t('Sticky <small>(stays at the top of listings)</small>'),
              'access' => array(
                'fasttoggle_node_sticky_access',
              ),
              'labels' => array(
                FASTTOGGLE_LABEL_ACTION => array(
                  0 => t('make sticky'),
                  1 => t('make unsticky'),
                ),
                FASTTOGGLE_LABEL_STATUS => array(
                  0 => t('not sticky'),
                  1 => t('sticky'),
                ),
              ),
            ),
            'promote' => array(
              'description' => t('Promoted <small>(visible on the front page)</small>'),
              'access' => array(
                'fasttoggle_node_promote_access',
              ),
              'labels' => array(
                FASTTOGGLE_LABEL_ACTION => array(
                  0 => t('promote'),
                  1 => t('demote'),
                ),
                FASTTOGGLE_LABEL_STATUS => array(
                  0 => t('not promoted'),
                  1 => t('promoted'),
                ),
              ),
            ),
          ),
        ),
      ),
    ),
  );
  return $result;
}