本文整理汇总了PHP中Drupal\node\Entity\NodeType类的典型用法代码示例。如果您正苦于以下问题:PHP NodeType类的具体用法?PHP NodeType怎么用?PHP NodeType使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了NodeType类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: testDisplayRevisionTab
/**
* Checks that the Revision tab is displayed correctly.
*/
function testDisplayRevisionTab()
{
$this->drupalPlaceBlock('local_tasks_block');
$this->drupalLogin($this->editor);
$node_storage = $this->container->get('entity.manager')->getStorage('node');
// Set page revision setting 'create new revision'. This will mean new
// revisions are created by default when the node is edited.
$type = NodeType::load('page');
$type->setNewRevision(TRUE);
$type->save();
// Create the node.
$node = $this->drupalCreateNode();
// Verify the checkbox is checked on the node edit form.
$this->drupalGet('node/' . $node->id() . '/edit');
$this->assertFieldChecked('edit-revision', "'Create new revision' checkbox is checked");
// Uncheck the create new revision checkbox and save the node.
$edit = array('revision' => FALSE);
$this->drupalPostForm('node/' . $node->id() . '/edit', $edit, 'Save and keep published');
$this->assertUrl($node->toUrl());
$this->assertNoLink(t('Revisions'));
// Verify the checkbox is checked on the node edit form.
$this->drupalGet('node/' . $node->id() . '/edit');
$this->assertFieldChecked('edit-revision', "'Create new revision' checkbox is checked");
// Submit the form without changing the checkbox.
$edit = array();
$this->drupalPostForm('node/' . $node->id() . '/edit', $edit, 'Save and keep published');
$this->assertUrl($node->toUrl());
$this->assertLink(t('Revisions'));
}
示例2: setUp
/**
* Performs setup tasks before each individual test method is run.
*/
public function setUp()
{
parent::setUp('content_access');
// The parent method already installs most needed node and comment schemas,
// but here we also need the comment statistics.
$this->installSchema('comment', array('comment_entity_statistics'));
// Create a node type for testing.
$type = NodeType::create(array('type' => 'page', 'name' => 'page'));
$type->save();
// Create anonymous user role.
$role = Role::create(array('id' => 'anonymous', 'label' => 'anonymous'));
$role->save();
// Insert the anonymous user into the database, as the user table is inner
// joined by \Drupal\comment\CommentStorage.
User::create(array('uid' => 0, 'name' => ''))->save();
// Create a node with attached comment.
$this->nodes[0] = Node::create(array('status' => NODE_PUBLISHED, 'type' => 'page', 'title' => 'test title'));
$this->nodes[0]->save();
$comment_type = CommentType::create(array('id' => 'comment', 'target_entity_type_id' => 'node'));
$comment_type->save();
$this->installConfig(array('comment'));
$this->addDefaultCommentField('node', 'page');
$comment = Comment::create(array('entity_type' => 'node', 'entity_id' => $this->nodes[0]->id(), 'field_name' => 'comment', 'body' => 'test body', 'comment_type' => $comment_type->id()));
$comment->save();
$this->comments[] = $comment;
$this->nodes[1] = Node::create(array('status' => NODE_PUBLISHED, 'type' => 'page', 'title' => 'some title'));
$this->nodes[1]->save();
$this->nodes[2] = Node::create(array('status' => NODE_NOT_PUBLISHED, 'type' => 'page', 'title' => 'other title'));
$this->nodes[2]->save();
// Also index users, to verify that they are unaffected by the processor.
$this->index->set('datasources', array('entity:comment', 'entity:node', 'entity:user'));
$this->index->save();
$this->index = entity_load('search_api_index', $this->index->id(), TRUE);
}
示例3: setUp
/**
* {@inheritdoc}
*/
protected function setUp()
{
parent::setUp();
$this->installEntitySchema('node');
// Need at least one node type present.
NodeType::create(['type' => 'testnodetype', 'name' => 'Test node type'])->save();
}
示例4: addParagraphedContentType
/**
* Adds a content type with a Paragraphs field.
*
* @param string $content_type_name
* Content type name to be used.
* @param string $paragraphs_field_name
* Paragraphs field name to be used.
*/
protected function addParagraphedContentType($content_type_name, $paragraphs_field_name)
{
// Create the content type.
$node_type = NodeType::create(['type' => $content_type_name, 'name' => $content_type_name]);
$node_type->save();
$this->addParagraphsField($content_type_name, $paragraphs_field_name, 'node');
}
示例5: testRenameValidation
/**
* Tests configuration renaming validation.
*/
public function testRenameValidation()
{
// Create a test entity.
$test_entity_id = $this->randomMachineName();
$test_entity = entity_create('config_test', array('id' => $test_entity_id, 'label' => $this->randomMachineName()));
$test_entity->save();
$uuid = $test_entity->uuid();
// Stage the test entity and then delete it from the active storage.
$active = $this->container->get('config.storage');
$sync = $this->container->get('config.storage.sync');
$this->copyConfig($active, $sync);
$test_entity->delete();
// Create a content type with a matching UUID in the active storage.
$content_type = NodeType::create(['type' => Unicode::strtolower($this->randomMachineName(16)), 'name' => $this->randomMachineName(), 'uuid' => $uuid]);
$content_type->save();
// Confirm that the staged configuration is detected as a rename since the
// UUIDs match.
$this->configImporter->reset();
$expected = array('node.type.' . $content_type->id() . '::config_test.dynamic.' . $test_entity_id);
$renames = $this->configImporter->getUnprocessedConfiguration('rename');
$this->assertIdentical($expected, $renames);
// Try to import the configuration. We expect an exception to be thrown
// because the staged entity is of a different type.
try {
$this->configImporter->import();
$this->fail('Expected ConfigImporterException thrown when a renamed configuration entity does not match the existing entity type.');
} catch (ConfigImporterException $e) {
$this->pass('Expected ConfigImporterException thrown when a renamed configuration entity does not match the existing entity type.');
$expected = array(SafeMarkup::format('Entity type mismatch on rename. @old_type not equal to @new_type for existing configuration @old_name and staged configuration @new_name.', array('@old_type' => 'node_type', '@new_type' => 'config_test', '@old_name' => 'node.type.' . $content_type->id(), '@new_name' => 'config_test.dynamic.' . $test_entity_id)));
$this->assertEqual($expected, $this->configImporter->getErrors());
}
}
示例6: testScheduledNodeDelete
/**
* Tests the deletion of a scheduled node.
*
* This tests if it is possible to delete a node that does not have a
* publication date set, when scheduled publishing is required.
*
* @see https://drupal.org/node/1614880
*/
public function testScheduledNodeDelete()
{
// Log in.
$this->drupalLogin($this->adminUser);
// Create a published and an unpublished node, both without scheduling.
$published_node = $this->drupalCreateNode(['type' => 'page', 'status' => 1]);
$unpublished_node = $this->drupalCreateNode(['type' => 'page', 'status' => 0]);
// Make scheduled publishing and unpublishing required.
$node_type = NodeType::load('page');
$node_type->setThirdPartySetting('scheduler', 'publish_required', TRUE);
$node_type->setThirdPartySetting('scheduler', 'unpublish_required', TRUE);
$node_type->save();
// Check that deleting the nodes does not throw form validation errors.
### @TODO Delete was a button in 7.x but a separate link node/<nid>/delete in 8.x
### Is the previous validation (that we had to avoid on delete) still done now in D8, given that there is no form?
### Maybe this test is not actually checking anything useful? Can it be altered to do something testable?
$this->drupalGet('node/' . $published_node->id() . '/delete');
// Note that the text 'error message' is used in a header h2 html tag which
// is normally made hidden from browsers but will be in the page source.
// It is also good when testing for the absense of somthing to also test
// for the presence of text, hence the second assertion for each check.
$this->assertNoRaw(t('Error message'), 'No error messages are shown when trying to delete a published node with no scheduling information.');
$this->assertRaw(t('Are you sure you want to delete the content'), 'The deletion warning message is shown immediately when trying to delete a published node with no scheduling information.');
$this->drupalGet('node/' . $unpublished_node->id() . '/delete');
$this->assertNoRaw(t('Error message'), 'No error messages are shown when trying to delete an unpublished node with no scheduling information.');
$this->assertRaw(t('Are you sure you want to delete the content'), 'The deletion warning message is shown immediately when trying to delete an unpublished node with no scheduling information.');
}
示例7: setUp
public function setUp() {
parent::setup();
$this->installConfig(array('pathauto', 'taxonomy', 'system', 'node'));
$this->installEntitySchema('user');
$this->installEntitySchema('node');
$this->installEntitySchema('taxonomy_term');
ConfigurableLanguage::createFromLangcode('fr')->save();
$this->installSchema('node', array('node_access'));
$this->installSchema('system', array('url_alias', 'sequences', 'router'));
$type = NodeType::create(['type' => 'page']);
$type->save();
node_add_body_field($type);
$this->nodePattern = $this->createPattern('node', '/content/[node:title]');
$this->userPattern = $this->createPattern('user', '/users/[user:name]');
\Drupal::service('router.builder')->rebuild();
$this->currentUser = entity_create('user', array('name' => $this->randomMachineName()));
$this->currentUser->save();
}
示例8: prepareTranslationSuggestions
/**
* Prepare a node to get suggestions from.
*
* Creates a node with two file fields. The first one is not translatable,
* the second one is. Both fields got two files attached, where one has
* translatable content (title and atl-text) and the other one not.
*
* @return object
* The node which is prepared with all needed fields for the suggestions.
*/
protected function prepareTranslationSuggestions()
{
// Create a content type with fields.
// Only the first field is a translatable reference.
$type = NodeType::create(['type' => $this->randomMachineName()]);
$type->save();
$content_translation_manager = \Drupal::service('content_translation.manager');
$content_translation_manager->setEnabled('node', $type->id(), TRUE);
$field1 = FieldStorageConfig::create(array('field_name' => 'field1', 'entity_type' => 'node', 'type' => 'entity_reference', 'cardinality' => -1, 'settings' => array('target_type' => 'node')));
$field1->save();
$field2 = FieldStorageConfig::create(array('field_name' => 'field2', 'entity_type' => 'node', 'type' => 'entity_reference', 'cardinality' => -1, 'settings' => array('target_type' => 'node')));
$field2->save();
// Create field instances on the content type.
FieldConfig::create(array('field_storage' => $field1, 'bundle' => $type->id(), 'label' => 'Field 1', 'translatable' => FALSE, 'settings' => array()))->save();
FieldConfig::create(array('field_storage' => $field2, 'bundle' => $type->id(), 'label' => 'Field 2', 'translatable' => TRUE, 'settings' => array()))->save();
// Create a translatable body field.
node_add_body_field($type);
$field = FieldConfig::loadByName('node', $type->id(), 'body');
$field->setTranslatable(TRUE);
$field->save();
// Create 4 nodes to be referenced.
$references = array();
for ($i = 0; $i < 4; $i++) {
$references[$i] = Node::create(array('title' => $this->randomMachineName(), 'body' => $this->randomMachineName(), 'type' => $type->id()));
$references[$i]->save();
}
// Create a node with two translatable and two non-translatable references.
$node = Node::create(array('title' => $this->randomMachineName(), 'type' => $type->id(), 'language' => 'en', 'body' => $this->randomMachineName(), $field1->getName() => array(array('target_id' => $references[0]->id()), array('target_id' => $references[1]->id())), $field2->getName() => array(array('target_id' => $references[2]->id()), array('target_id' => $references[3]->id()))));
$node->save();
$link = MenuLinkContent::create(['link' => [['uri' => 'entity:node/' . $node->id()]], 'title' => 'Node menu link', 'menu_name' => 'main']);
$link->save();
$node->link = $link;
return $node;
}
示例9: testExportWithReferences
/**
* Tests exportContentWithReferences().
*/
public function testExportWithReferences()
{
\Drupal::service('module_installer')->install(['node', 'default_content']);
\Drupal::service('router.builder')->rebuild();
$this->defaultContentManager = \Drupal::service('default_content.manager');
$user = User::create(['name' => 'my username']);
$user->save();
// Reload the user to get the proper casted values from the DB.
$user = User::load($user->id());
$node_type = NodeType::create(['type' => 'test']);
$node_type->save();
$node = Node::create(['type' => $node_type->id(), 'title' => 'test node', 'uid' => $user->id()]);
$node->save();
// Reload the node to get the proper casted values from the DB.
$node = Node::load($node->id());
/** @var \Symfony\Component\Serializer\Serializer $serializer */
$serializer = \Drupal::service('serializer');
\Drupal::service('rest.link_manager')->setLinkDomain(DefaultContentManager::LINK_DOMAIN);
$expected_node = $serializer->serialize($node, 'hal_json', ['json_encode_options' => JSON_PRETTY_PRINT]);
$expected_user = $serializer->serialize($user, 'hal_json', ['json_encode_options' => JSON_PRETTY_PRINT]);
$exported_by_entity_type = $this->defaultContentManager->exportContentWithReferences('node', $node->id());
// Ensure that the node type is not tryed to be exported.
$this->assertEqual(array_keys($exported_by_entity_type), ['node', 'user']);
// Ensure the right UUIDs are exported.
$this->assertEqual([$node->uuid()], array_keys($exported_by_entity_type['node']));
$this->assertEqual([$user->uuid()], array_keys($exported_by_entity_type['user']));
// Compare the actual serialized data.
$this->assertEqual(reset($exported_by_entity_type['node']), $expected_node);
$this->assertEqual(reset($exported_by_entity_type['user']), $expected_user);
}
示例10: testNodeFormSaveWithoutRevision
/**
* Checks that unchecking 'Create new revision' works when editing a node.
*/
function testNodeFormSaveWithoutRevision()
{
$this->drupalLogin($this->editor);
$node_storage = $this->container->get('entity.manager')->getStorage('node');
// Set page revision setting 'create new revision'. This will mean new
// revisions are created by default when the node is edited.
$type = NodeType::load('page');
$type->setNewRevision(TRUE);
$type->save();
// Create the node.
$node = $this->drupalCreateNode();
// Verify the checkbox is checked on the node edit form.
$this->drupalGet('node/' . $node->id() . '/edit');
$this->assertFieldChecked('edit-revision', "'Create new revision' checkbox is checked");
// Uncheck the create new revision checkbox and save the node.
$edit = array('revision' => FALSE);
$this->drupalPostForm('node/' . $node->id() . '/edit', $edit, t('Save and keep published'));
// Load the node again and check the revision is the same as before.
$node_storage->resetCache(array($node->id()));
$node_revision = $node_storage->load($node->id(), TRUE);
$this->assertEqual($node_revision->getRevisionId(), $node->getRevisionId(), "After an existing node is saved with 'Create new revision' unchecked, a new revision is not created.");
// Verify the checkbox is checked on the node edit form.
$this->drupalGet('node/' . $node->id() . '/edit');
$this->assertFieldChecked('edit-revision', "'Create new revision' checkbox is checked");
// Submit the form without changing the checkbox.
$edit = array();
$this->drupalPostForm('node/' . $node->id() . '/edit', $edit, t('Save and keep published'));
// Load the node again and check the revision is different from before.
$node_storage->resetCache(array($node->id()));
$node_revision = $node_storage->load($node->id());
$this->assertNotEqual($node_revision->getRevisionId(), $node->getRevisionId(), "After an existing node is saved with 'Create new revision' checked, a new revision is created.");
}
示例11: setUp
protected function setUp()
{
parent::setUp();
node_access_test_add_field(NodeType::load('article'));
node_access_rebuild();
\Drupal::state()->set('node_access_test.private', TRUE);
}
示例12: testNodeType
/**
* Tests Drupal 6 node type to Drupal 8 migration.
*/
public function testNodeType()
{
$migration = entity_load('migration', 'd6_node_type');
// Test the test_page content type.
$node_type_page = NodeType::load('test_page');
$this->assertIdentical('test_page', $node_type_page->id(), 'Node type test_page loaded');
$this->assertIdentical(TRUE, $node_type_page->displaySubmitted());
$this->assertIdentical(FALSE, $node_type_page->isNewRevision());
$this->assertIdentical(DRUPAL_OPTIONAL, $node_type_page->getPreviewMode());
$this->assertIdentical($migration->getIdMap()->lookupDestinationID(array('test_page')), array('test_page'));
// Test we have a body field.
$field = FieldConfig::loadByName('node', 'test_page', 'body');
$this->assertIdentical('This is the body field label', $field->getLabel(), 'Body field was found.');
// Test the test_story content type.
$node_type_story = NodeType::load('test_story');
$this->assertIdentical('test_story', $node_type_story->id(), 'Node type test_story loaded');
$this->assertIdentical(TRUE, $node_type_story->displaySubmitted());
$this->assertIdentical(FALSE, $node_type_story->isNewRevision());
$this->assertIdentical(DRUPAL_OPTIONAL, $node_type_story->getPreviewMode());
$this->assertIdentical($migration->getIdMap()->lookupDestinationID(array('test_story')), array('test_story'));
// Test we don't have a body field.
$field = FieldConfig::loadByName('node', 'test_story', 'body');
$this->assertIdentical(NULL, $field, 'No body field found');
// Test the test_event content type.
$node_type_event = NodeType::load('test_event');
$this->assertIdentical('test_event', $node_type_event->id(), 'Node type test_event loaded');
$this->assertIdentical(TRUE, $node_type_event->displaySubmitted());
$this->assertIdentical(TRUE, $node_type_event->isNewRevision());
$this->assertIdentical(DRUPAL_OPTIONAL, $node_type_event->getPreviewMode());
$this->assertIdentical($migration->getIdMap()->lookupDestinationID(array('test_event')), array('test_event'));
// Test we have a body field.
$field = FieldConfig::loadByName('node', 'test_event', 'body');
$this->assertIdentical('Body', $field->getLabel(), 'Body field was found.');
}
示例13: setUp
/**
* {@inheritdoc}
*/
protected function setUp()
{
parent::setUp();
$this->installEntitySchema('node');
$this->installEntitySchema('comment');
$this->installEntitySchema('taxonomy_term');
CommentType::create(['id' => 'comment_node_page', 'label' => $this->randomMachineName()])->save();
CommentType::create(['id' => 'comment_node_article', 'label' => $this->randomMachineName()])->save();
CommentType::create(['id' => 'comment_node_blog', 'label' => $this->randomMachineName()])->save();
CommentType::create(['id' => 'comment_node_book', 'label' => $this->randomMachineName()])->save();
CommentType::create(['id' => 'comment_node_forum', 'label' => $this->randomMachineName()])->save();
CommentType::create(['id' => 'comment_node_test_content_type', 'label' => $this->randomMachineName()])->save();
NodeType::create(['type' => 'page', 'label' => $this->randomMachineName()])->save();
NodeType::create(['type' => 'article', 'label' => $this->randomMachineName()])->save();
NodeType::create(['type' => 'blog', 'label' => $this->randomMachineName()])->save();
NodeType::create(['type' => 'book', 'label' => $this->randomMachineName()])->save();
NodeType::create(['type' => 'forum', 'label' => $this->randomMachineName()])->save();
NodeType::create(['type' => 'test_content_type', 'label' => $this->randomMachineName()])->save();
Vocabulary::create(['vid' => 'test_vocabulary'])->save();
// Give one unfortunate field instance invalid display settings to ensure
// that the migration provides an empty array as a default (thus avoiding
// an "unsupported operand types" fatal).
Database::getConnection('default', 'migrate')->update('field_config_instance')->fields(array('data' => serialize(array('label' => 'Body', 'widget' => array('type' => 'text_textarea_with_summary', 'settings' => array('rows' => 20, 'summary_rows' => 5), 'weight' => -4, 'module' => 'text'), 'settings' => array('display_summary' => TRUE, 'text_processing' => 1, 'user_register_form' => FALSE), 'display' => array('default' => array('label' => 'hidden', 'type' => 'text_default', 'settings' => array(), 'module' => 'text', 'weight' => 0), 'teaser' => array('label' => 'hidden', 'type' => 'text_summary_or_trimmed', 'settings' => NULL, 'module' => 'text', 'weight' => 0)), 'required' => FALSE, 'description' => ''))))->condition('entity_type', 'node')->condition('bundle', 'article')->condition('field_name', 'body')->execute();
$this->executeMigrations(['d7_field', 'd7_field_instance', 'd7_view_modes', 'd7_field_formatter_settings']);
}
示例14: settingsForm
/**
* {@inheritdoc}
*/
public function settingsForm(array $form, FormStateInterface $form_state)
{
$options = array();
$types = NodeType::loadMultiple();
$comment_fields = $this->commentManager ? $this->commentManager->getFields('node') : array();
$map = array($this->t('Hidden'), $this->t('Closed'), $this->t('Open'));
foreach ($types as $type) {
$options[$type->id()] = array('type' => array('#markup' => $this->t($type->label())));
if ($this->commentManager) {
$fields = array();
foreach ($comment_fields as $field_name => $info) {
// Find all comment fields for the bundle.
if (in_array($type->id(), $info['bundles'])) {
$instance = FieldConfig::loadByName('node', $type->id(), $field_name);
$default_mode = reset($instance->default_value);
$fields[] = SafeMarkup::format('@field: !state', array('@field' => $instance->label(), '!state' => $map[$default_mode['status']]));
}
}
// @todo Refactor display of comment fields.
if (!empty($fields)) {
$options[$type->id()]['comments'] = array('data' => array('#theme' => 'item_list', '#items' => $fields));
} else {
$options[$type->id()]['comments'] = $this->t('No comment fields');
}
}
}
if (empty($options)) {
$create_url = $this->urlGenerator->generateFromRoute('node.type_add');
$this->setMessage($this->t('You do not have any content types that can be generated. <a href="@create-type">Go create a new content type</a> already!</a>', array('@create-type' => $create_url)), 'error', FALSE);
return;
}
$header = array('type' => $this->t('Content type'));
if ($this->commentManager) {
$header['comments'] = array('data' => $this->t('Comments'), 'class' => array(RESPONSIVE_PRIORITY_MEDIUM));
}
$form['node_types'] = array('#type' => 'tableselect', '#header' => $header, '#options' => $options);
$form['kill'] = array('#type' => 'checkbox', '#title' => $this->t('<strong>Delete all content</strong> in these content types before generating new content.'), '#default_value' => $this->getSetting('kill'));
$form['num'] = array('#type' => 'textfield', '#title' => $this->t('How many nodes would you like to generate?'), '#default_value' => $this->getSetting('num'), '#size' => 10);
$options = array(1 => $this->t('Now'));
foreach (array(3600, 86400, 604800, 2592000, 31536000) as $interval) {
$options[$interval] = \Drupal::service('date.formatter')->formatInterval($interval, 1) . ' ' . $this->t('ago');
}
$form['time_range'] = array('#type' => 'select', '#title' => $this->t('How far back in time should the nodes be dated?'), '#description' => $this->t('Node creation dates will be distributed randomly from the current time, back to the selected time.'), '#options' => $options, '#default_value' => 604800);
$form['max_comments'] = array('#type' => $this->moduleHandler->moduleExists('comment') ? 'textfield' : 'value', '#title' => $this->t('Maximum number of comments per node.'), '#description' => $this->t('You must also enable comments for the content types you are generating. Note that some nodes will randomly receive zero comments. Some will receive the max.'), '#default_value' => $this->getSetting('max_comments'), '#size' => 3, '#access' => $this->moduleHandler->moduleExists('comment'));
$form['title_length'] = array('#type' => 'textfield', '#title' => $this->t('Maximum number of words in titles'), '#default_value' => $this->getSetting('title_length'), '#size' => 10);
$form['add_alias'] = array('#type' => 'checkbox', '#disabled' => !$this->moduleHandler->moduleExists('path'), '#description' => $this->t('Requires path.module'), '#title' => $this->t('Add an url alias for each node.'), '#default_value' => FALSE);
$form['add_statistics'] = array('#type' => 'checkbox', '#title' => $this->t('Add statistics for each node (node_counter table).'), '#default_value' => TRUE, '#access' => $this->moduleHandler->moduleExists('statistics'));
$options = array();
// We always need a language
$languages = \Drupal::languageManager()->getLanguages(LanguageInterface::STATE_ALL);
foreach ($languages as $langcode => $language) {
$options[$langcode] = $language->getName();
}
$default_language = \Drupal::service('language.default')->get();
$default_langcode = $default_language->getId();
$form['add_language'] = array('#type' => 'select', '#title' => $this->t('Set language on nodes'), '#multiple' => TRUE, '#description' => $this->t('Requires locale.module'), '#options' => $options, '#default_value' => array($default_langcode));
$form['submit'] = array('#type' => 'submit', '#value' => $this->t('Generate'), '#tableselect' => TRUE);
$form['#redirect'] = FALSE;
return $form;
}
示例15: setUp
protected function setUp()
{
parent::setUp();
// Ensure the page node type exists.
NodeType::create(['type' => 'page', 'name' => 'page'])->save();
ViewTestData::createTestViews(get_class($this), array('field_test_views'));
}