You are here

public function FlexiformElementNodePromote::form in Flexiform 7

Return the form element for this FlexiformElement.

Overrides FlexiformElement::form

File

includes/element/node_promote.element.inc, line 15
Contains class for the Node promote element.

Class

FlexiformElementNodePromote
Class to add the node promote field to a form.

Code

public function form($form, &$form_state, $entity, $language = LANGUAGE_NONE) {
  $parents = $form['#parents'];
  $parents[] = 'promote';
  $form[$this->element_namespace] = array(
    '#type' => 'checkbox',
    '#parents' => $parents,
    '#title' => $this
      ->label(),
    '#default_value' => !empty($entity->promote) ? $entity->promote : FALSE,
  );
  $form = parent::form($form, $form_state, $entity);
  return $form;
}