field_ui_form_node_type_form_alter

function field_ui_form_node_type_form_alter

field_ui_form_node_type_form_alter(&$form, $form_state)

Implements hook_form_FORM_ID_alter().

Adds a button 'Save and add fields' to the 'Create content type' form.

See also

node_type_form()

field_ui_form_node_type_form_submit()

File

modules/field_ui/field_ui.module, line 383
Allows administrators to attach custom fields to fieldable types.

Code

function field_ui_form_node_type_form_alter(&$form, $form_state) {
  // We want to display the button only on add page.
  if (empty($form['#node_type']->type)) {
    $form['actions']['save_continue'] = array(
      '#type' => 'submit',
      '#value' => t('Save and add fields'),
      '#weight' => 45,
    );
    $form['#submit'][] = 'field_ui_form_node_type_form_submit';
  }
}

© 2001–2016 by the original authors
Licensed under the GNU General Public License, version 2 and later.
Drupal is a registered trademark of Dries Buytaert.
https://api.drupal.org/api/drupal/modules!field_ui!field_ui.module/function/field_ui_form_node_type_form_alter/7.x

在线笔记
App下载
App下载

扫描二维码

下载编程狮App

公众号
微信公众号

编程狮公众号

意见反馈
返回顶部