Attach checklists to entities as fields

Created on 2 August 2013, over 11 years ago
Updated 13 September 2024, 2 months ago

Status:

Pending resolution of 🌱 Create a new architecture for checklists as config entities, with tasks fulfilled by conditions Active .

Original report

I would like to propose a patch which will allow me to "attach" a checklist to all nodes of certain content type by implementing the following two hooks:

/**
 * Implements hook_node_view().
 */
function onboarding_node_view($node, $view_mode, $langcode) {
  if ($node->type === 'new_employee' && $view_mode === 'full') {
    $form = drupal_get_form('onboarding_checklist_form', $node->nid);
    $form['title'] = array(
      '#markup' => '<h2>' . $form['#checklist']->title . '</h2>'
    );
    $node->content['onboarding_checklist'] = $form;
  }
}

/**
 * Form callback for Onboarding checklist.
 */
function onboarding_checklist_form($form, &$form_state, $nid) {
  module_load_include('inc', 'checklistapi', 'checklistapi.pages');
  $delta = '_node_' . $nid;
  $form = checklistapi_checklist_form($form, $form_state, 'onboarding', $delta);

  unset($form['actions']['clear'], $form['compact_mode_link']);

  return $form;
}
✨ Feature request
Status

Postponed

Version

2.0

Component

Code

Created by

πŸ‡§πŸ‡¬Bulgaria mmartinov

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

Production build 0.71.5 2024