You are here

public function YoastSeoManager::detachFieldHandlerFromContentView in Real-time SEO for Drupal 8

Detach the field handler for yoast seo from the content view.

File

src/YoastSeoManager.php, line 180

Class

YoastSeoManager
Class YoastSeoManager.

Namespace

Drupal\yoast_seo

Code

public function detachFieldHandlerFromContentView() {
  $content_view = Views::getView('content');
  if ($content_view) {
    $display_id = 'page_1';
    $handlers = $content_view
      ->getHandlers('field', $display_id);
    if (isset($handlers['field_yoast_seo'])) {
      $content_view
        ->removeHandler($display_id, 'field', 'field_yoast_seo');
      $content_view
        ->save();
    }
  }
}