Commit a82a5efe authored by alexpott's avatar alexpott

Issue #1981198 by yched: Change notice: More accurate names and form_ids() for...

Issue #1981198 by yched: Change notice: More accurate names and form_ids() for Field UI form classes.
parent f5945be4
......@@ -19,9 +19,9 @@ interface FormatterInterface extends PluginSettingsInterface {
/**
* Returns a form to configure settings for the formatter.
*
* Invoked from field_ui_field_edit_form() to allow administrators to
* configure the formatter. The field_ui module takes care of handling
* submitted form values.
* Invoked from \Drupal\field_ui\Form\FieldInstanceEditForm to allow
* administrators to configure the formatter. The field_ui module takes care
* of handling submitted form values.
*
* @param array $form
* The form where the settings form is being included in.
......
......@@ -23,9 +23,9 @@ interface WidgetInterface extends WidgetBaseInterface {
/**
* Returns a form to configure settings for the widget.
*
* Invoked from field_ui_field_edit_form() to allow administrators to
* configure the widget. The field_ui module takes care of handling submitted
* form values.
* Invoked from \Drupal\field_ui\Form\FieldInstanceEditForm to allow
* administrators to configure the widget. The field_ui module takes care of
* handling submitted form values.
*
* @param array $form
* The form where the settings form is being included in.
......
......@@ -13,10 +13,10 @@
/**
* Add settings to a field settings form.
*
* Invoked from field_ui_field_settings_form() to allow the module defining the
* field to add global settings (i.e. settings that do not depend on the bundle
* or instance) to the field settings form. If the field already has data, only
* include settings that are safe to change.
* Invoked from \Drupal\field_ui\Form\FieldInstanceEditForm to allow the module
* defining the field to add global settings (i.e. settings that do not depend
* on the bundle or instance) to the field settings form. If the field already
* has data, only include settings that are safe to change.
*
* @todo: Only the field type module knows which settings will affect the
* field's schema, but only the field storage module knows what schema
......@@ -51,8 +51,8 @@ function hook_field_settings_form($field, $instance, $has_data) {
/**
* Add settings to an instance field settings form.
*
* Invoked from field_ui_field_edit_form() to allow the module defining the
* field to add settings for a field instance.
* Invoked from \Drupal\field_ui\Form\FieldInstanceEditForm to allow the module
* defining the field to add settings for a field instance.
*
* @param $field
* The field structure being configured.
......
......@@ -88,10 +88,10 @@ function field_ui_menu() {
'title' => 'Edit',
'type' => MENU_DEFAULT_LOCAL_TASK,
);
$items["$path/fields/%/field-settings"] = array(
$items["$path/fields/%/field"] = array(
'title' => 'Field settings',
'type' => MENU_LOCAL_TASK,
'route_name' => "field_ui.settings.$entity_type",
'route_name' => "field_ui.field_edit.$entity_type",
);
$items["$path/fields/%/widget-type"] = array(
'title' => 'Widget type',
......
......@@ -125,7 +125,7 @@ public function buildForm(array $form, array &$form_state, $entity_type = NULL,
'type' => array(
'#type' => 'link',
'#title' => $field_types[$field['type']]['label'],
'#href' => $admin_field_path . '/field-settings',
'#href' => $admin_field_path . '/field',
'#options' => array('attributes' => array('title' => t('Edit field settings.'))),
),
'widget_type' => array(
......@@ -576,7 +576,7 @@ public function submitForm(array &$form, array &$form_state) {
// Always show the field settings step, as the cardinality needs to be
// configured for new fields.
$destinations[] = $this->adminPath. '/fields/' . $new_instance->id() . '/field-settings';
$destinations[] = $this->adminPath. '/fields/' . $new_instance->id() . '/field';
$destinations[] = $this->adminPath . '/fields/' . $new_instance->id();
// Store new field information for any additional submit handlers.
......
......@@ -2,7 +2,7 @@
/**
* @file
* Contains \Drupal\field_ui\Form\FieldSettingsForm.
* Contains \Drupal\field_ui\Form\FieldEditForm.
*/
namespace Drupal\field_ui\Form;
......@@ -14,7 +14,7 @@
/**
* Provides a form for the field settings edit page.
*/
class FieldSettingsForm implements FormInterface {
class FieldEditForm implements FormInterface {
/**
* The field instance being edited.
......@@ -27,7 +27,7 @@ class FieldSettingsForm implements FormInterface {
* {@inheritdoc}
*/
public function getFormID() {
return 'field_ui_field_settings_form';
return 'field_ui_field_edit_form';
}
/**
......
......@@ -55,7 +55,7 @@ public static function create(ContainerInterface $container) {
* {@inheritdoc}
*/
public function getFormID() {
return 'field_ui_field_edit_form';
return 'field_ui_field_instance_edit_form';
}
/**
......
......@@ -60,18 +60,18 @@ public function routes(RouteBuildEvent $event) {
$collection->add("field_ui.instance_edit.$entity_type", $route);
$route = new Route(
"$path/fields/{field_instance}/widget-type",
array('_form' => '\Drupal\field_ui\Form\FieldWidgetTypeForm'),
"$path/fields/{field_instance}/field",
array('_form' => '\Drupal\field_ui\Form\FieldEditForm'),
array('_permission' => 'administer ' . $entity_type . ' fields')
);
$collection->add("field_ui.widget_type.$entity_type", $route);
$collection->add("field_ui.field_edit.$entity_type", $route);
$route = new Route(
"$path/fields/{field_instance}/field-settings",
array('_form' => '\Drupal\field_ui\Form\FieldSettingsForm'),
"$path/fields/{field_instance}/widget-type",
array('_form' => '\Drupal\field_ui\Form\FieldWidgetTypeForm'),
array('_permission' => 'administer ' . $entity_type . ' fields')
);
$collection->add("field_ui.settings.$entity_type", $route);
$collection->add("field_ui.widget_type.$entity_type", $route);
$route = new Route(
"$path/fields/{field_instance}/delete",
......
......@@ -125,7 +125,7 @@ function createField() {
function updateField() {
$instance_id = 'node.' . $this->type . '.' . $this->field_name;
// Go to the field edit page.
$this->drupalGet('admin/structure/types/manage/' . $this->type . '/fields/' . $instance_id . '/field-settings');
$this->drupalGet('admin/structure/types/manage/' . $this->type . '/fields/' . $instance_id . '/field');
// Populate the field settings with new settings.
$string = 'updated dummy test string';
......@@ -177,7 +177,7 @@ function addExistingField() {
* numeric value. That is tested already in FormTest::testNumber().
*/
function cardinalitySettings() {
$field_edit_path = 'admin/structure/types/manage/article/fields/node.article.body/field-settings';
$field_edit_path = 'admin/structure/types/manage/article/fields/node.article.body/field';
// Assert the cardinality other field cannot be empty when cardinality is
// set to other.
......
......@@ -211,7 +211,7 @@ function testPrivateFileSetting() {
// Change the field setting to make its files private, and upload a file.
$edit = array('field[settings][uri_scheme]' => 'private');
$this->drupalPost("admin/structure/types/manage/$type_name/fields/$instance->id/field-settings", $edit, t('Save field settings'));
$this->drupalPost("admin/structure/types/manage/$type_name/fields/$instance->id/field", $edit, t('Save field settings'));
$nid = $this->uploadNodeFile($test_file, $field_name, $type_name);
$node = node_load($nid, TRUE);
$node_file = file_load($node->{$field_name}[LANGUAGE_NOT_SPECIFIED][0]['fid']);
......@@ -223,12 +223,12 @@ function testPrivateFileSetting() {
// Ensure we can't change 'uri_scheme' field settings while there are some
// entities with uploaded files.
$this->drupalGet("admin/structure/types/manage/$type_name/fields/$instance->id/field-settings");
$this->drupalGet("admin/structure/types/manage/$type_name/fields/$instance->id/field");
$this->assertFieldByXpath('//input[@id="edit-field-settings-uri-scheme-public" and @disabled="disabled"]', 'public', t('Upload destination setting disabled.'));
// Delete node and confirm that setting could be changed.
node_delete($nid);
$this->drupalGet("admin/structure/types/manage/$type_name/fields/$instance->id/field-settings");
$this->drupalGet("admin/structure/types/manage/$type_name/fields/$instance->id/field");
$this->assertFieldByXpath('//input[@id="edit-field-settings-uri-scheme-public" and not(@disabled)]', 'public', t('Upload destination setting enabled.'));
}
......
......@@ -74,7 +74,7 @@ function testDefaultImages() {
->save();
// Confirm the defaults are present on the article field settings form.
$this->drupalGet("admin/structure/types/manage/article/fields/$instance->id/field-settings");
$this->drupalGet("admin/structure/types/manage/article/fields/$instance->id/field");
$this->assertFieldByXpath(
'//input[@name="field[settings][default_image][fids]"]',
$default_images['field']->fid,
......@@ -95,7 +95,7 @@ function testDefaultImages() {
);
// Confirm the defaults are present on the page field settings form.
$this->drupalGet("admin/structure/types/manage/page/fields/$instance->id/field-settings");
$this->drupalGet("admin/structure/types/manage/page/fields/$instance->id/field");
$this->assertFieldByXpath(
'//input[@name="field[settings][default_image][fids]"]',
$default_images['field']->fid,
......@@ -144,7 +144,7 @@ function testDefaultImages() {
field_update_field($field);
// Confirm that the new default is used on the article field settings form.
$this->drupalGet("admin/structure/types/manage/article/fields/$instance->id/field-settings");
$this->drupalGet("admin/structure/types/manage/article/fields/$instance->id/field");
$this->assertFieldByXpath(
'//input[@name="field[settings][default_image][fids]"]',
$default_images['field_new']->fid,
......
......@@ -226,7 +226,7 @@ function testImageFieldDefaultImage() {
$edit = array(
'files[field_settings_default_image]' => drupal_realpath($images[0]->uri),
);
$this->drupalPost("admin/structure/types/manage/article/fields/node.article.$field_name/field-settings", $edit, t('Save field settings'));
$this->drupalPost("admin/structure/types/manage/article/fields/node.article.$field_name/field", $edit, t('Save field settings'));
// Clear field info cache so the new default image is detected.
field_info_cache_clear();
$field = field_info_field($field_name);
......@@ -254,7 +254,7 @@ function testImageFieldDefaultImage() {
$edit = array(
'field[settings][default_image][fids]' => 0,
);
$this->drupalPost("admin/structure/types/manage/article/fields/node.article.$field_name/field-settings", $edit, t('Save field settings'));
$this->drupalPost("admin/structure/types/manage/article/fields/node.article.$field_name/field", $edit, t('Save field settings'));
// Clear field info cache so the new default image is detected.
field_info_cache_clear();
$field = field_info_field($field_name);
......@@ -267,7 +267,7 @@ function testImageFieldDefaultImage() {
$edit = array(
'files[field_settings_default_image]' => drupal_realpath($images[1]->uri),
);
$this->drupalPost('admin/structure/types/manage/article/fields/node.article.' . $private_field_name . '/field-settings', $edit, t('Save field settings'));
$this->drupalPost('admin/structure/types/manage/article/fields/node.article.' . $private_field_name . '/field', $edit, t('Save field settings'));
// Clear field info cache so the new default image is detected.
field_info_cache_clear();
......
......@@ -266,7 +266,7 @@ protected function createOptionsField($type) {
);
field_create_instance($instance);
$this->admin_path = 'admin/structure/types/manage/' . $this->type . '/fields/node.' . $this->type . '.' . $this->field_name . '/field-settings';
$this->admin_path = 'admin/structure/types/manage/' . $this->type . '/fields/node.' . $this->type . '.' . $this->field_name . '/field';
}
/**
......
......@@ -92,7 +92,7 @@ function testTextField() {
function testTextFieldFormatted() {
// Make node body multiple.
$edit = array('field[container][cardinality]' => -1);
$this->drupalPost('admin/structure/types/manage/article/fields/node.article.body/field-settings', $edit, t('Save field settings'));
$this->drupalPost('admin/structure/types/manage/article/fields/node.article.body/field', $edit, t('Save field settings'));
$this->drupalGet('node/add/article');
$this->assertFieldByXPath("//input[@name='body_add_more']", t('Add another item'), 'Body field cardinality set to multiple.');
......
......@@ -801,9 +801,9 @@ function translation_entity_field_extra_fields() {
}
/**
* Implements hook_form_FORM_ID_alter() for field_ui_field_settings_form().
* Implements hook_form_FORM_ID_alter() for 'field_ui_field_edit_form'.
*/
function translation_entity_form_field_ui_field_settings_form_alter(array &$form, array &$form_state, $form_id) {
function translation_entity_form_field_ui_field_edit_form_alter(array &$form, array &$form_state, $form_id) {
$field = $form['#field'];
$field_name = $field['field_name'];
$translatable = $field['translatable'];
......@@ -836,9 +836,9 @@ function translation_entity_form_field_ui_field_settings_form_alter(array &$form
}
/**
* Implements hook_form_FORM_ID_alter().
* Implements hook_form_FORM_ID_alter() for 'field_ui_field_instance_edit_form'.
*/
function translation_entity_form_field_ui_field_edit_form_alter(array &$form, array &$form_state, $form_id) {
function translation_entity_form_field_ui_field_instance_edit_form_alter(array &$form, array &$form_state, $form_id) {
if ($form['#field']['translatable']) {
module_load_include('inc', 'translation_entity', 'translation_entity.admin');
$element = translation_entity_field_sync_widget($form['#field'], $form['#instance']);
......
......@@ -2554,12 +2554,12 @@ function user_block_user_action(&$entity, $context = array()) {
}
/**
* Implements hook_form_FORM_ID_alter().
* Implements hook_form_FORM_ID_alter() for 'field_ui_field_instance_edit_form'.
*
* Add a checkbox for the 'user_register_form' instance settings on the 'Edit
* field instance' form.
*/
function user_form_field_ui_field_edit_form_alter(&$form, &$form_state, $form_id) {
function user_form_field_ui_field_instance_edit_form_alter(&$form, &$form_state, $form_id) {
$instance = $form_state['instance'];
if ($instance['entity_type'] == 'user') {
......@@ -2585,7 +2585,7 @@ function user_form_field_ui_field_edit_form_alter(&$form, &$form_state, $form_id
),
);
array_unshift($form['#submit'], 'user_form_field_ui_field_edit_form_submit');
array_unshift($form['#submit'], 'user_form_field_ui_field_instance_edit_form_submit');
}
}
......@@ -2594,7 +2594,7 @@ function user_form_field_ui_field_edit_form_alter(&$form, &$form_state, $form_id
*
* Make sure the 'user_register_form' setting is set for required fields.
*/
function user_form_field_ui_field_edit_form_submit($form, &$form_state) {
function user_form_field_ui_field_instance_edit_form_submit($form, &$form_state) {
$instance = $form_state['values']['instance'];
if (!empty($instance['required'])) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment