diff --git a/core/lib/Drupal/Core/Ajax/DialogController.php b/core/lib/Drupal/Core/Ajax/DialogController.php index 41cdd02..eff0d1f 100644 --- a/core/lib/Drupal/Core/Ajax/DialogController.php +++ b/core/lib/Drupal/Core/Ajax/DialogController.php @@ -17,9 +17,9 @@ class DialogController extends ContainerAware { /** - * Utility to get forward request to a subrequest. + * Forwards request to a subrequest. * - * @param Request $request + * @param \Symfony\Component\HttpFoundation\RequestRequest $request * The request object. * @param callable $content * The body content callable that contains the body region of this page. @@ -27,7 +27,7 @@ class DialogController extends ContainerAware { * @return \Symfony\Component\HttpFoundation\Response * A response object. */ - protected function forward($request, $content) { + protected function forward(Request $request, $content) { // @todo When we have a Generator, we can replace the forward() call with // a render() call, which would handle ESI and hInclude as well. That will // require an _internal route. For examples, see: @@ -46,9 +46,9 @@ protected function forward($request, $content) { } /** - * Wrapper to display content in a modal dialog. + * Displays content in a modal dialog. * - * @param Request $request + * @param \Symfony\Component\HttpFoundation\RequestRequest $request * The request object. * @param callable $_content * The body content callable that contains the body region of this page. @@ -61,9 +61,9 @@ public function modal(Request $request, $_content) { } /** - * Wrapper to display content in a dialog. + * Displays content in a dialog. * - * @param Request $request + * @param \Symfony\Component\HttpFoundation\RequestRequest $request * The request object. * @param callable $_content * The body content callable that contains the body region of this page. @@ -76,34 +76,16 @@ public function modal(Request $request, $_content) { public function dialog(Request $request, $_content, $modal = FALSE) { $subrequest = $this->forward($request, $_content); if ($subrequest->isOk()) { - $output = $subrequest->getContent(); - // A page callback could return a render array or a string. - if (is_array($output)) { - // Subrequest has set dialog title in the output. - if (isset($output['title'])) { - $title = $output['title']['#value']; - unset($output['title']); - } - else { - // Legacy fallback. - // @todo remove when http://drupal.org/node/1830588 lands. - $title = drupal_get_title(); - } - $content = drupal_render($output); - } - else { - // Legacy fallback. - // @todo remove when http://drupal.org/node/1830588 lands and all routes - // converted to return render arrays. - $title = drupal_get_title(); - $content = $output; - } + $content = $subrequest->getContent(); + // @todo Remove use of drupal_get_title() when + // http://drupal.org/node/1871596 is in. + $title = drupal_get_title(); $response = new AjaxResponse(); // Fetch any modal options passed in from data-dialog-options. if (!($options = $request->request->get('dialogOptions'))) { $options = array(); } - // Set modal flag and re-use the modal id. + // Set modal flag and re-use the modal ID. if ($modal) { $options['modal'] = TRUE; $target = '#drupal-modal'; diff --git a/core/lib/Drupal/Core/Routing/Enhancer/ModalEnhancer.php b/core/lib/Drupal/Core/Routing/Enhancer/ModalEnhancer.php index c492e8c..652206b 100644 --- a/core/lib/Drupal/Core/Routing/Enhancer/ModalEnhancer.php +++ b/core/lib/Drupal/Core/Routing/Enhancer/ModalEnhancer.php @@ -7,9 +7,6 @@ namespace Drupal\Core\Routing\Enhancer; -use Symfony\Component\HttpFoundation\Request; -use Drupal\Core\ContentNegotiation; - /** * Enhances a route to use the DialogController for matching requests. */ diff --git a/core/modules/config/config.admin.inc b/core/modules/config/config.admin.inc index 4e12ea4..57704de 100644 --- a/core/modules/config/config.admin.inc +++ b/core/modules/config/config.admin.inc @@ -79,7 +79,7 @@ function config_admin_sync_form(array &$form, array &$form_state, StorageInterfa 'class' => array('use-ajax'), 'data-accepts' => 'application/vnd.drupal-modal', 'data-dialog-options' => json_encode(array( - 'width' => 500 + 'width' => 700 )), ), ); @@ -125,7 +125,7 @@ function config_admin_import_form_submit($form, &$form_state) { if (!lock()->lockMayBeAvailable(CONFIG_IMPORT_LOCK)) { drupal_set_message(t('Another request may be synchronizing configuration already.')); } - elseif (config_import()) { + else if (config_import()) { // Once a sync completes, we empty the staging directory. This prevents // changes from being accidentally overwritten by stray files getting // imported later. diff --git a/core/modules/config/lib/Drupal/config/Controller/ConfigController.php b/core/modules/config/lib/Drupal/config/Controller/ConfigController.php index 471d656..905c2bc 100644 --- a/core/modules/config/lib/Drupal/config/Controller/ConfigController.php +++ b/core/modules/config/lib/Drupal/config/Controller/ConfigController.php @@ -30,14 +30,14 @@ class ConfigController implements ControllerInterface { protected $sourceStorage; /** - * Inject the target and source config storage services. + * {@inheritdoc} */ public static function create(ContainerInterface $container) { return new static($container->get('config.storage'), $container->get('config.storage.staging')); } /** - * Constructor. + * Constructs a ConfigController object. * * @param \Drupal\Core\Config\StorageInterface $target_storage * The target storage. @@ -89,13 +89,9 @@ public function diff($config_file) { '#href' => 'admin/config/development/sync', ); - $title = t('View changes of @config_file', array('@config_file' => $config_file)); - $output['title'] = array( - '#theme' => 'html_tag', - '#tag' => 'h3', - '#value' => $title, - '#weight' => -10, - ); + // @todo Remove use of drupal_set_title() when + // http://drupal.org/node/1871596 is in. + drupal_set_title('View changes of @config_file', array('@config_file' => $config_file)); return $output; } diff --git a/core/modules/simpletest/lib/Drupal/simpletest/WebTestBase.php b/core/modules/simpletest/lib/Drupal/simpletest/WebTestBase.php index de16d51..144e5f5 100644 --- a/core/modules/simpletest/lib/Drupal/simpletest/WebTestBase.php +++ b/core/modules/simpletest/lib/Drupal/simpletest/WebTestBase.php @@ -1196,7 +1196,7 @@ protected function drupalGet($path, array $options = array(), array $headers = a } /** - * Retrieve a Drupal path or an absolute path and JSON decode the result. + * Retrieves a Drupal path or an absolute path and JSON decode the result. * * @param string $path * Path to request AJAX from. diff --git a/core/modules/system/tests/modules/ajax_test/ajax_test.module b/core/modules/system/tests/modules/ajax_test/ajax_test.module index 2522c15..e7a252c 100644 --- a/core/modules/system/tests/modules/ajax_test/ajax_test.module +++ b/core/modules/system/tests/modules/ajax_test/ajax_test.module @@ -237,7 +237,7 @@ function _ajax_test_dialog($is_modal = FALSE) { } /** - * Utlity function: Returns the contents for dialog tests. + * Returns example content for dialog tests. */ function ajax_test_dialog_contents() { // This is a regular render array; the keys do not have special meaning. diff --git a/core/modules/system/tests/modules/ajax_test/lib/Drupal/ajax_test/AjaxTestController.php b/core/modules/system/tests/modules/ajax_test/lib/Drupal/ajax_test/AjaxTestController.php index c8ba8c4..53044c5 100644 --- a/core/modules/system/tests/modules/ajax_test/lib/Drupal/ajax_test/AjaxTestController.php +++ b/core/modules/system/tests/modules/ajax_test/lib/Drupal/ajax_test/AjaxTestController.php @@ -7,6 +7,9 @@ namespace Drupal\ajax_test; +/** + * Provides content for dialog tests. + */ class AjaxTestController { /**