diff --cc core/modules/config/tests/config_test/config_test.module index 5dbcb92,9a0e901..0000000 --- a/core/modules/config/tests/config_test/config_test.module +++ b/core/modules/config/tests/config_test/config_test.module @@@ -136,3 -211,27 +149,30 @@@ function config_test_cache_flush() return array(); } ++<<<<<<< HEAD ++======= + + /** + * Enables a ConfigTest object. + * + * @param Drupal\config_test\ConfigTest $config_test + * The ConfigTest object to enable. + */ + function config_test_entity_enable(ConfigTest $config_test) { + $config_test->enable(); + $config_test->save(); + return new RedirectResponse(url('admin/structure/config_test', array('absolute' => TRUE))); + } + + /** + * Disables a ConfigTest object. + * + * @param Drupal\config_test\ConfigTest $config_test + * The ConfigTest object to disable. + */ + function config_test_entity_disable(ConfigTest $config_test) { + $config_test->disable(); + $config_test->save(); + return new RedirectResponse(url('admin/structure/config_test', array('absolute' => TRUE))); + } ++>>>>>>> 63 diff --cc core/modules/views/lib/Drupal/views/Plugin/Core/Entity/View.php index 6837952,d998cd1..0000000 --- a/core/modules/views/lib/Drupal/views/Plugin/Core/Entity/View.php +++ b/core/modules/views/lib/Drupal/views/Plugin/Core/Entity/View.php @@@ -169,38 -159,6 +160,41 @@@ class View extends ConfigEntityBase imp } /** ++<<<<<<< HEAD + * Overrides Drupal\Core\Config\Entity\ConfigEntityBase::createDuplicate(). + */ + public function createDuplicate() { + $duplicate = parent::createDuplicate(); + unset($duplicate->executable); + return $duplicate; + } + + /** + * Implements Drupal\views\ViewStorageInterface::enable(). + */ + public function enable() { + $this->disabled = FALSE; + $this->save(); + } + + /** + * Implements Drupal\views\ViewStorageInterface::disable(). + */ + public function disable() { + $this->disabled = TRUE; + $this->save(); + } + + /** + * Implements Drupal\views\ViewStorageInterface::isEnabled(). + */ + public function isEnabled() { + return !$this->disabled; + } + + /** ++======= ++>>>>>>> 63 * Return the human readable name for a view. * * When a certain view doesn't have a human readable name return the machine readable name. diff --cc core/modules/views/lib/Drupal/views/ViewStorageController.php index a3a3437,a79b94a..0000000 --- a/core/modules/views/lib/Drupal/views/ViewStorageController.php +++ b/core/modules/views/lib/Drupal/views/ViewStorageController.php @@@ -99,4 -99,29 +99,32 @@@ class ViewStorageController extends Con } } ++<<<<<<< HEAD ++======= + /** + * Overrides Drupal\config\ConfigStorageController::getProperties(); + */ + protected function getProperties(EntityInterface $entity) { + $names = array( + 'api_version', + 'base_field', + 'base_table', + 'core', + 'description', + 'status', + 'display', + 'human_name', + 'module', + 'name', + 'tag', + 'uuid', + ); + $properties = array(); + foreach ($names as $name) { + $properties[$name] = $entity->get($name); + } + return $properties; + } + ++>>>>>>> 63 } diff --cc core/modules/views/views.module index f4d8404,1c28842..0000000 --- a/core/modules/views/views.module +++ b/core/modules/views/views.module @@@ -519,6 -626,127 +519,130 @@@ function views_contextual_links_view_al } /** ++<<<<<<< HEAD ++======= + * Implement hook_block_info(). + */ + function views_block_info() { + // Try to avoid instantiating all the views just to get the blocks info. + views_include('cache'); + $cache = views_cache_get('views_block_items', TRUE); + if ($cache && is_array($cache->data)) { + return $cache->data; + } + + $items = array(); + $views = views_get_all_views(); + foreach ($views as $view) { + // disabled views get nothing. + if (!$view->status()) { + continue; + } + + $executable = $view->get('executable'); + $executable->initDisplay(); + foreach ($executable->displayHandlers as $display) { + + if (isset($display) && !empty($display->definition['uses_hook_block'])) { + $result = $display->executeHookBlockList(); + if (is_array($result)) { + $items = array_merge($items, $result); + } + } + + if (isset($display) && $display->getOption('exposed_block')) { + $result = $display->getSpecialBlocks(); + if (is_array($result)) { + $items = array_merge($items, $result); + } + } + } + } + + // block.module has a delta length limit of 32, but our deltas can + // unfortunately be longer because view names can be 32 and display IDs + // can also be 32. So for very long deltas, change to md5 hashes. + $hashes = array(); + + // get the keys because we're modifying the array and we don't want to + // confuse PHP too much. + $keys = array_keys($items); + foreach ($keys as $delta) { + if (strlen($delta) >= 32) { + $hash = md5($delta); + $hashes[$hash] = $delta; + $items[$hash] = $items[$delta]; + unset($items[$delta]); + } + } + + // Only save hashes if they have changed. + $old_hashes = state()->get('views_block_hashes'); + if ($hashes != $old_hashes) { + state()->set('views_block_hashes', $hashes); + } + + views_cache_set('views_block_items', $items, TRUE); + + return $items; + } + + /** + * Implement hook_block_view(). + */ + function views_block_view($delta) { + $start = microtime(TRUE); + // if this is 32, this should be an md5 hash. + if (strlen($delta) == 32) { + $hashes = state()->get('views_block_hashes'); + if (!empty($hashes[$delta])) { + $delta = $hashes[$delta]; + } + } + + // This indicates it's a special one. + if (substr($delta, 0, 1) == '-') { + list($nothing, $type, $name, $display_id) = explode('-', $delta); + // Put the - back on. + $type = '-' . $type; + if ($view = views_get_view($name)) { + if ($view->access($display_id)) { + $view->setDisplay($display_id); + if (isset($view->display_handler)) { + $output = $view->display_handler->viewSpecialBlocks($type); + // Before returning the block output, convert it to a renderable + // array with contextual links. + views_add_block_contextual_links($output, $view, $display_id, 'special_block_' . $type); + $view->destroy(); + return $output; + } + } + $view->destroy(); + } + } + + // If the delta doesn't contain valid data return nothing. + $explode = explode('-', $delta); + if (count($explode) != 2) { + return; + } + list($name, $display_id) = $explode; + // Load the view + if ($view = views_get_view($name)) { + if ($view->access($display_id)) { + $output = $view->executeDisplay($display_id); + // Before returning the block output, convert it to a renderable array + // with contextual links. + views_add_block_contextual_links($output, $view, $display_id); + $view->destroy(); + return $output; + } + $view->destroy(); + } + } + + /** ++>>>>>>> 63 * Converts Views block content to a renderable array with contextual links. * * @param $block diff --cc core/modules/views/views_ui/lib/Drupal/views_ui/ViewListController.php index 46c139b,e9f0db9..0000000 --- a/core/modules/views/views_ui/lib/Drupal/views_ui/ViewListController.php +++ b/core/modules/views/views_ui/lib/Drupal/views_ui/ViewListController.php @@@ -19,18 -19,15 +19,27 @@@ class ViewListController extends Entity * Overrides Drupal\Core\Entity\EntityListController::load(); */ public function load() { ++<<<<<<< HEAD + $entities = array( + 'enabled' => array(), + 'disabled' => array(), + ); + foreach (parent::load() as $entity) { + if ($entity->isEnabled()) { + $entities['enabled'][] = $entity; + } + else { + $entities['disabled'][] = $entity; ++======= + $entities = parent::load(); + uasort($entities, function ($a, $b) { + $a_enabled = $a->status(); + $b_enabled = $b->status(); + if ($a_enabled != $b_enabled) { + return $a_enabled < $b_enabled; ++>>>>>>> 63 } - return $a->id() > $b->id(); - }); + } return $entities; } * Unmerged path core/modules/views/tests/views_test_config/config/views.view.test_views_move_to_field.yml * Unmerged path core/modules/views/tests/views_test_config/config/views.view.test_views_move_to_handler.yml