Same name in other branches
  1. 7.x-3.x plugins/QuickNodeContent.inc \QuickNodeContent::optionsForm()

Overrides QuickContent::optionsForm

Fichier

src/Plugin/QuickContent/QuickNodeContent.php, line 34

Classe

QuickNodeContent
Class for tab content of type "node" - this is for rendering a node as tab content. @QuicktabFormat{ id = "quicknodecontent" }

Namespace

Drupal\quicktabs\Plugin\QuickContent

Code

public function optionsForm($delta, $qt, $form) {
    $tab = $this->settings;
    $form = array();
    $form['node']['nid'] = array(
        '#type' => 'textfield',
        '#title' => t('Node'),
        '#description' => t('The node ID of the node.'),
        '#maxlength' => 10,
        '#size' => 20,
        '#default_value' => isset($tab['nid']) ? $tab['nid'] : '',
    );
    $entity_info = \Drupal::entityManager()->getDefinition('node');
    $view_modes = array();
    foreach ($entity_info['view modes'] as $view_mode_name => $view_mode) {
        $view_modes[$view_mode_name] = $view_mode['label'];
    }
    $form['node']['view_mode'] = array(
        '#type' => 'select',
        '#title' => t('View mode'),
        '#options' => $view_modes,
        '#default_value' => isset($tab['view_mode']) ? $tab['view_mode'] : 'full',
    );
    $form['node']['hide_title'] = array(
        '#type' => 'checkbox',
        '#title' => t('Hide the title of this node'),
        '#default_value' => isset($tab['hide_title']) ? $tab['hide_title'] : 1,
    );
    return $form;
}