本文整理汇总了PHP中ctools_export_ui::edit_form方法的典型用法代码示例。如果您正苦于以下问题:PHP ctools_export_ui::edit_form方法的具体用法?PHP ctools_export_ui::edit_form怎么用?PHP ctools_export_ui::edit_form使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ctools_export_ui
的用法示例。
在下文中一共展示了ctools_export_ui::edit_form方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: array
function edit_form(&$form, &$form_state) {
parent::edit_form($form, $form_state);
$form['category'] = array(
'#type' => 'textfield',
'#title' => t('Category'),
'#description' => t('What category this content should appear in. If left blank the category will be "Miscellaneous".'),
'#default_value' => $form_state['item']->category,
);
$form['title'] = array(
'#type' => 'textfield',
'#default_value' => $form_state['item']->settings['title'],
'#title' => t('Title'),
);
$form['body_field']['body'] = array(
'#title' => t('Body'),
'#type' => 'textarea',
'#default_value' => $form_state['item']->settings['body'],
);
$parents[] = 'format';
$form['body_field']['format'] = filter_form($form_state['item']->settings['format'], 1, $parents);
$form['substitute'] = array(
'#type' => 'checkbox',
'#title' => t('Use context keywords'),
'#description' => t('If checked, context keywords will be substituted in this content.'),
'#default_value' => !empty($form_state['item']->settings['substitute']),
);
}
示例2: array
/**
* Provide the actual editing form.
*/
function edit_form(&$form, &$form_state)
{
parent::edit_form($form, $form_state);
$form['title'] = array('#type' => 'textfield', '#title' => t('Title'), '#description' => t('A human-readable title for the provider.'), '#size' => 32, '#maxlength' => 255, '#required' => TRUE, '#default_value' => $form_state['item']->title);
$form['endpoint'] = array('#type' => 'textfield', '#title' => t('Endpoint'), '#description' => t('The endpoint where oEmbed requests are going to be sent.'), '#size' => 32, '#maxlength' => 255, '#required' => TRUE, '#default_value' => $form_state['item']->endpoint);
$form['scheme'] = array('#type' => 'textarea', '#title' => t('Schemes'), '#description' => t('Newline separated list of schemes like !example', array('!example' => 'http://*.revision3.com/*')), '#required' => TRUE, '#default_value' => $form_state['item']->scheme);
}
示例3: array
/**
* Provide the actual editing form.
*/
function edit_form(&$form, &$form_state)
{
parent::edit_form($form, $form_state);
$item = $form_state['item'];
$form['info']['admin_title']['#required'] = TRUE;
$form['info']['admin_title']['#maxlength'] = 80;
$form['path'] = array('#type' => 'textarea', '#title' => t('Paths'), '#default_value' => $item->path, '#maxlength' => 128, '#size' => 45, '#description' => t('Specify pages by using their paths. Enter one path per line. The \'*\' character is a wildcard. Example paths are %blog for the blog page and %blog-wildcard for every personal blog. %front is the front page.', array('%blog' => 'blog', '%blog-wildcard' => 'blog/*', '%front' => '<front>')), '#required' => TRUE);
$form['help'] = array('#type' => 'textarea', '#title' => t('Help message'), '#default_value' => $item->help, '#description' => t('Specify a help message.'), '#required' => TRUE);
$form['options'] = array('#type' => 'vertical_tabs');
$form['options_roles'] = array('#type' => 'fieldset', '#title' => t('Roles'), '#collapsible' => TRUE, '#group' => 'options', '#weight' => -50);
$item->options = unserialize($item->options);
$roles = user_roles(FALSE, 'view custom help text');
// Get all Authenticated roles
if (isset($roles[DRUPAL_AUTHENTICATED_RID])) {
$roles += array_diff(user_roles(TRUE), $roles);
}
if (user_access('administer permissions')) {
$permission_link = l(t('View custom help text'), 'admin/people/permissions', array('fragment' => 'module-custom_help_text'));
} else {
$permission_link = t('View custom help text');
}
$form['options_roles']['roles'] = array('#type' => 'checkboxes', '#options' => $roles, '#title' => t('User roles that can view the custom help text'), '#required' => TRUE, '#description' => t('Check the roles that needs to view the help message and have currently the permission \'!permission_url\'.', array('!permission_url' => $permission_link)));
if (!empty($item->options['roles'])) {
foreach ($item->options['roles'] as $role_name) {
if ($role = user_role_load_by_name($role_name)) {
$form['options_roles']['roles']['#default_value'][] = $role->rid;
}
}
} else {
$form['options_roles']['roles']['#default_value'] = array();
}
}
示例4: array
/**
* Adding or editing snippet
* @param $form
* @param $form_state
*/
function edit_form(&$form, &$form_state)
{
// this is to show the preview
$form['snippet_preview_wrapper'] = array('#prefix' => '<div id="snippet_preview">', '#suffix' => '</div>', '#markup' => '');
// adding parent element
parent::edit_form($form, $form_state);
if ($form_state['form type'] == 'clone') {
$default_snippet = $this->load_item($form_state['original name']);
} elseif ($form_state['form type'] == 'add') {
$default_snippet = $form_state['item'];
$default_snippet->rid = NULL;
$default_snippet->content = '';
} else {
$default_snippet = $form_state['item'];
}
// Needs to disable the admin_tile and name (machine name) fields
// and delete button for editing snippet
if ($form_state['op'] == 'edit') {
$form['info']['admin_title']['#disabled'] = TRUE;
$form['info']['name']['#disabled'] = TRUE;
$form['buttons']['delete']['#access'] = FALSE;
}
$form['title'] = array('#type' => 'textfield', '#title' => t('Title'), '#description' => t('Title for the textarea-exportible.'), '#default_value' => $default_snippet->rid ? $default_snippet->title_revision : $default_snippet->title);
$form['content'] = array('#type' => 'text_format', '#title' => t('Content'), '#description' => t('Description of this snippet.'), '#default_value' => $default_snippet->content, '#format' => @$default_snippet->content_format);
$form['preview'] = array('#type' => 'button', '#limit_validation_errors' => array(), '#value' => t('Preview'), '#submit' => array('snippet_build_preview'), '#ajax' => array('callback' => 'snippet_form_build_preview_callback', 'wrapper' => 'snippet_preview'), '#weight' => 101);
}
示例5: array
/**
* Allow users to jump right into adding fields.
*/
function edit_form(&$form, &$form_state)
{
parent::edit_form($form, $form_state);
if (module_exists('field_ui')) {
$form['buttons']['save_continue'] = array('#type' => 'submit', '#value' => t('Save and add fields'), '#access' => $form_state['op'] == 'add' || $form_state['op'] == 'clone');
}
}
示例6: array
/**
* Implements ctools_export_ui::edit_form().
*/
function edit_form(&$form, &$form_state)
{
parent::edit_form($form, $form_state);
$retrieve_plugins = mailhandler_get_plugins('mailhandler', 'retrieve');
if (count($retrieve_plugins) == 1) {
mailhandler_report('warning', 'No retrieval plugins are available. Please <a href="@module-page">enable a module</a> providing a retrieval plugin, such as the Mailhandler PHP IMAP module.', array('@module-page' => url('admin/modules')));
}
global $cookie_domain;
extract($form_state['item']->settings);
$form['info']['admin_title']['#description'] = t('Suggested, but not required, to be the email address of the mailbox.');
$form['connection']['#tree'] = FALSE;
$form['connection']['settings'] = array('#type' => 'fieldset', '#title' => 'Mailbox connection settings', '#tree' => TRUE, '#collapsible' => TRUE, '#after_build' => array('_mailhandler_include_js'));
$form['connection']['settings']['type'] = array('#type' => 'select', '#title' => t('Protocol'), '#options' => array('imap' => 'IMAP', 'pop3' => 'POP3', 'local' => 'Local mbox file'), '#default_value' => $type, '#description' => t('You can use the IMAP/POP3 protocols, or retrieve from an mbox file on the local file system.'));
$ajax_settings = array('callback' => '_mailhandler_mailbox_test', 'wrapper' => 'mailhandler_test_results', 'event' => 'change', 'progress' => array('type' => 'throbber', 'message' => t('Please wait - testing connection settings...')));
$form['connection']['settings']['folder'] = array('#type' => 'textfield', '#title' => t('Folder'), '#default_value' => $folder, '#description' => t('The folder where the mail is stored. If you want this mailbox to read from a local mbox file, give an absolute path or the path relative to the Drupal installation directory.'), '#ajax' => $ajax_settings);
$form['connection']['settings']['domain'] = array('#type' => 'textfield', '#title' => t('Domain'), '#default_value' => $domain ? $domain : trim($cookie_domain, '.'), '#description' => t('The domain of the server used to collect mail.'), '#ajax' => $ajax_settings);
$form['connection']['settings']['port'] = array('#type' => 'textfield', '#title' => t('Port'), '#size' => 5, '#maxlength' => 5, '#default_value' => $port, '#description' => t('The mailbox port number (usually 110 for POP3, 143 for IMAP).'), '#element_validate' => array('element_validate_integer_positive'), '#ajax' => $ajax_settings);
$form['connection']['settings']['name'] = array('#type' => 'textfield', '#title' => t('Username'), '#default_value' => $name, '#description' => t('This username is used while logging into this mailbox during mail retrieval.'), '#ajax' => $ajax_settings);
$form['connection']['settings']['pass'] = array('#type' => 'textfield', '#title' => t('Password'), '#default_value' => $pass, '#description' => t('The password corresponding to the username above. Consider using a non-vital password, since this field is stored without encryption in the database.'), '#ajax' => $ajax_settings);
// Allow administrators to configure the mailbox with extra IMAP commands (notls, novalidate-cert etc.)
$form['connection']['settings']['extraimap'] = array('#type' => 'textfield', '#title' => t('Extra commands'), '#default_value' => $extraimap, '#description' => t('In some circumstances you need to issue extra commands to connect to your mail server (e.g. "/notls", "/novalidate-cert" etc.). See documentation for <a href="@imap-open">imap_open</a>.', array('@imap-open' => url('http://php.net/imap_open'))), '#ajax' => $ajax_settings);
$form['connection']['settings']['results'] = array('#type' => 'container', '#attributes' => array('id' => 'mailhandler_test_results'));
$form['extra']['#tree'] = FALSE;
$form['extra']['settings'] = array('#type' => 'fieldset', '#title' => 'More settings', '#tree' => TRUE, '#collapsible' => TRUE, '#collapsed' => TRUE);
$form['extra']['settings']['limit'] = array('#type' => 'textfield', '#title' => t('Maximum messages to retrieve'), '#size' => 5, '#maxlength' => 5, '#default_value' => $limit, '#description' => t('To prevent timeout errors from large mailboxes you can limit the maximum number of messages that will be retrieved during each cron run. Set to zero for no limit.'), '#element_validate' => array('element_validate_integer'));
$form['extra']['settings']['encoding'] = array('#type' => 'textfield', '#title' => t('Default character encoding'), '#default_value' => $encoding, '#description' => t('The default character encoding to use when an incoming message does not define an encoding.'));
$form['extra']['settings']['flag_after_read'] = array('#type' => 'checkbox', '#title' => t('Mark messages as seen/read after they are processed?'), '#default_value' => isset($flag_after_read) ? $flag_after_read : TRUE, '#description' => t('Note that messages cannot be marked as seen/read for POP3 accounts.'));
$form['extra']['settings']['delete_after_read'] = array('#type' => 'checkbox', '#title' => t('Delete messages after they are processed?'), '#default_value' => $delete_after_read, '#description' => t('Uncheck this box to leave read messages in the mailbox. They will not be processed again unless they become marked as unread. If you selected "POP3" as your mailbox type, you must check this box.'));
$form['extra']['settings']['fromheader'] = array('#type' => 'textfield', '#title' => t('From header'), '#default_value' => $fromheader, '#description' => t('Use this e-mail header to determine the author of the resulting node. <strong>Sender</strong> is useful when working with listservs.'));
$form['extra']['settings']['security'] = array('#type' => 'radios', '#title' => t('Security'), '#options' => array(t('Disabled'), t('Require password')), '#default_value' => $security, '#description' => t('Disable security if your site does not require a password in the Commands section of incoming e-mails. Note: Security=Enabled and MIME preference=HTML is an unsupported combination.'));
$form['extra']['settings']['replies'] = array('#type' => 'radios', '#title' => t('Send error replies'), '#options' => array(t('Disabled'), t('Enabled')), '#default_value' => $replies, '#description' => t('Send helpful replies to all unsuccessful e-mail submissions. Consider disabling when a listserv posts to this mailbox.'));
$form['extra']['settings']['retrieve'] = array('#type' => 'select', '#title' => t('Retrieval library'), '#options' => _mailhandler_build_options($retrieve_plugins), '#default_value' => $retrieve, '#description' => t('The library that will be used to retrieve messages.'), '#required' => TRUE);
}
示例7: array
function edit_form(&$form, &$form_state)
{
// Get the basic edit form
parent::edit_form($form, $form_state);
$form['category'] = array('#type' => 'textfield', '#size' => 24, '#default_value' => $form_state['item']->category, '#title' => t('Category'), '#description' => t("The category that this mini-panel will be grouped into on the Add Content form. Only upper and lower-case alphanumeric characters are allowed. If left blank, defaults to 'Mini panels'."));
$form['title']['#title'] = t('Title');
$form['title']['#description'] = t('The title for this mini panel. It can be overridden in the block configuration.');
}
示例8: array
function edit_form(&$form, &$form_state)
{
parent::edit_form($form, $form_state);
$item = $form_state['item'];
$form['html'] = array('#type' => 'textarea', '#title' => t('HTML Code'), '#default_value' => $item->html, '#required' => TRUE, '#description' => t('Html code template.'), "#rows" => 20);
$form['css'] = array('#type' => 'textarea', '#title' => t('Inline CSS'), '#default_value' => $item->css, '#required' => FALSE, '#description' => t('CSS code for template.'), "#rows" => 20);
$form['ext_js'] = array('#type' => 'textarea', '#title' => t('External JS'), '#default_value' => $item->ext_js, '#required' => FALSE, '#description' => t('Add external Javascript files to template, each css link per line.'), "#rows" => 5);
$form['ext_css'] = array('#type' => 'textarea', '#title' => t('External CSS'), '#default_value' => $item->ext_css, '#required' => FALSE, '#description' => t('Add external CSS files to template, each css link per line.'), "#rows" => 5);
}
示例9: array
/**
* @see ctools_export_ui::edit_form()
*/
function edit_form(&$form, &$form_state) {
parent::edit_form($form, $form_state);
$form['#attached']['js'] = array(
drupal_get_path('module', 'uc_custom_payment') . '/plugins/export_ui/uc_custom_payment_ui.js',
);
$form['info']['admin_title']['#title'] = t('Name');
$form['info']['admin_title']['#required'] = TRUE;
$form['info']['admin_title']['#description'] = t('The name of this payment method as it will appear in administrative lists');
$form['info']['name']['#machine_name']['exists'] = 'uc_custom_payment_name_exists';
$form['title'] = array(
'#type' => 'textfield',
'#title' => t('Title'),
'#default_value' => empty($form_state['item']->title) ? '' : $form_state['item']->title,
'#description' => t('The title of this payment method as it will appear to the customer.'),
'#required' => TRUE,
);
$form['instructions'] = array(
'#type' => 'text_format',
'#title' => t('Instructions'),
'#default_value' => empty($form_state['item']->instructions) ? '' : $form_state['item']->instructions['value'],
'#format' => empty($form_state['item']->instructions) ? filter_default_format() : $form_state['item']->instructions['format'],
'#description' => t('The instructions for this payment method which will appear when the method is selected.'),
);
if (module_exists('token')) {
$form['instructions']['#description'] .= ' ' . t('You may use any of the following replacement patterns.');
$form['instructions']['#suffix'] = theme('token_tree', array('token_types' => array('uc_order')));
}
$default = '';
if (!empty($form_state['item']->data['service_charge'])) {
$default = $form_state['item']->data['service_charge'];
if ($form_state['item']->data['service_charge_type'] === 'percentage') {
$default .= '%';
}
}
$form['service_charge'] = array(
'#type' => 'textfield',
'#title' => t('Service Charge'),
'#field_prefix' => variable_get('uc_sign_after_amount', FALSE) ? '' : variable_get('uc_currency_sign', '$'),
'#field_suffix' => variable_get('uc_sign_after_amount', FALSE) ? variable_get('uc_currency_sign', '$') : '',
'#default_value' => $default,
'#description' => t('The service charge to be applied to the order when this payment method is selected.
May be an absolute price or percent of order total (e.g. enter "15%"). Leave blank for no service charge.'),
);
$form['service_charge_title'] = array(
'#type' => 'textfield',
'#title' => t('Service Charge Title'),
'#default_value' => empty($form_state['item']->data['service_charge_title']) ? t('Service charge') : $form_state['item']->data['service_charge_title'],
'#description' => t('The line item title to use for the service charge.'),
'#states' => array(
'visible' => array(
'input[name="service_charge"]' => array('filled' => TRUE),
),
),
);
}
示例10: edit_form
/**
* Include some ctools stuff required for drupal ajax to work properly.
* @see ctools_export_ui::edit_form()
*/
public function edit_form(&$form, &$form_state)
{
// This is needed in order to get the ajax working in the ctools form.
ctools_include('plugins');
ctools_include('export');
ctools_get_plugins('ctools', 'export_ui', 'entity_collection');
parent::edit_form($form, $form_state);
// We need to define our own function, the one provided by ctools does not
// work with the Drupal ajax API.
$form['info']['name']['#machine_name']['exists'] = 'entity_collection_bundle_exists';
}
示例11: array
function edit_form(&$form, &$form_state)
{
// Correct for an error that came in because filter format changed.
if (is_array($form_state['item']->settings['body'])) {
$form_state['item']->settings['format'] = $form_state['item']->settings['body']['format'];
$form_state['item']->settings['body'] = $form_state['item']->settings['body']['value'];
}
parent::edit_form($form, $form_state);
$form['category'] = array('#type' => 'textfield', '#title' => t('Category'), '#description' => t('What category this content should appear in. If left blank the category will be "Miscellaneous".'), '#default_value' => $form_state['item']->category);
$form['title'] = array('#type' => 'textfield', '#default_value' => $form_state['item']->settings['title'], '#title' => t('Title'));
$form['body'] = array('#type' => 'text_format', '#title' => t('Body'), '#default_value' => $form_state['item']->settings['body'], '#format' => $form_state['item']->settings['format']);
$form['substitute'] = array('#type' => 'checkbox', '#title' => t('Use context keywords'), '#description' => t('If checked, context keywords will be substituted in this content.'), '#default_value' => !empty($form_state['item']->settings['substitute']));
}
示例12: array
/**
* Provide the actual editing form.
*/
function edit_form(&$form, &$form_state)
{
parent::edit_form($form, $form_state);
// Add the buttons if the wizard is not in use.
if (empty($form_state['form_info'])) {
// Add buttons.
$form['buttons']['submit']['#attributes'] = array('class' => array('enabled-for-ajax'));
// Disable view display selection if a view has not been chosen.
if (empty($form_state['values']['name'])) {
$form['buttons']['submit']['#disabled'] = TRUE;
}
}
}
示例13: array
function edit_form(&$form, &$form_state)
{
parent::edit_form($form, $form_state);
$layer_types = openlayers_layer_types();
$options = array('' => t('Select the layer type'));
$layer = NULL;
if ($form_state['op'] == 'edit' && $form_state['form type'] == 'edit') {
$layer = openlayers_layer_load($form_state['item']->name);
}
if ($form_state['op'] == 'add' && $form_state['form type'] == 'clone') {
$layer = openlayers_layer_load($form_state['function args'][2]->name);
$layer->title = t('Clone of ') . $layer->title;
}
$form['info']['title'] = array('#id' => 'layertitle', '#type' => 'textfield', '#weight' => -1, '#title' => t('Layer Title'), '#default_value' => isset($layer->title) ? $layer->title : '', '#description' => t('The friendly name of your layer, which will appear in the administration interface as well on the map interface if it is exposed.'));
$form['info']['name']['#machine_name']['source'] = array('info', 'title');
$layers_options = array();
// Go trough all layer types and get each options form.
foreach ($layer_types as $layer_type) {
if (is_object($layer) && get_class($layer) == $layer_type['layer_type']['class']) {
// Layer is of current layer type.
$layer_type_object = $layer;
} else {
// Otherwise load layer object for current layer type.
$layer_type_object = openlayers_layer_type_load($layer_type['name']);
}
$layer_options_form = array();
if (method_exists($layer_type_object, 'options_form')) {
// This is because the class openlayers_layer_type
// is not abstract.
// Maybe there's a better way to do ?
$parent = get_parent_class($layer_type_object);
$parent_object = new $parent();
$layer_options_form = $layer_type_object->options_form() + $parent_object->options_form($layer);
}
// TODO First case can never be true without crashing earlier
if ($layer_type_object == FALSE || empty($layer_options_form)) {
continue;
}
$layers_option = array('#type' => 'fieldset', '#tree' => TRUE, '#title' => t('Layer specific options for @layer_title', array('@layer_title' => $layer_type['title'])));
$layers_option += $layer_options_form;
$layers_option['#states'] = array('visible' => array(':input[name="layer_type"]' => array('value' => $layer_type['name'])));
$layers_option['layer_type'] = array('#type' => 'hidden', '#value' => $layer_type['name']);
$layers_options[$layer_type['name']] = $layers_option;
$options[$layer_type['name']] = $layer_type['title'];
}
$form['layer_type'] = array('#type' => 'select', '#title' => t('Layer Type'), '#default_value' => isset($layer->data['layer_type']) ? $layer->data['layer_type'] : '', '#description' => t('Select the type of layer.'), '#options' => $options);
$form += $layers_options;
$form['buttons']['submit']['#weight'] = 0;
$form['buttons']['delete']['#weight'] = 20;
$form['buttons']['saveandedit'] = array('#type' => 'submit', '#value' => t('Save and edit'), '#weight' => 10);
}
示例14: t
function edit_form(&$form, &$form_state)
{
// Get the basic edit form
parent::edit_form($form, $form_state);
// Set the admin title machine name length.
// We need to do this because the system block name length is
// limited to 32 chars.
$form['info']['name']['#maxlength'] = 32;
$form['info']['name']['#size'] = 34;
$form['info']['name']['#description'] .= ' ' . t('The machine name length is limited to 32 characters, due to a limitation in the core block system.');
$form['category'] = array('#type' => 'textfield', '#size' => 24, '#default_value' => $form_state['item']->category, '#title' => t('Category'), '#description' => t("The category that this mini-panel will be grouped into on the Add Content form. Only upper and lower-case alphanumeric characters are allowed. If left blank, defaults to 'Mini panels'."));
$form['title']['#title'] = t('Title');
$form['title']['#description'] = t('The title for this mini panel. It can be overridden in the block configuration.');
}
示例15: isset
/**
* {@inheritdoc}
*/
function edit_form(&$form, &$form_state)
{
parent::edit_form($form, $form_state);
$preset = $form_state['item'];
// Determine the currently selected entity type.
$selected = isset($form_state['values']['entity_type']) ? $form_state['values']['entity_type'] : $preset->entity_type;
// Disable form submission if an entity type has not been selected.
if (empty($selected)) {
$form['buttons']['submit']['#disabled'] = TRUE;
}
// Wrap the submit button in markup to allow it to be targeted with JS.
$form['buttons']['submit']['#prefix'] = '<span id="save-button">';
$form['buttons']['submit']['#suffix'] = '</span>';
}