Exemplo n.º 1
0
 /**
  * Gets a page description for all pages.
  *
  * Only type aanbod UiT domein, theme and location need to be prepared for search engines.
  *
  * @see culturefeed_search_ui_search_page()
  *
  * @return string
  *   Description for this type of page.
  */
 public function getPageDescription()
 {
     $message = "";
     $query = drupal_get_query_parameters(NULL, array('q'));
     if (empty($query)) {
         $message = t("A summary of all pages on @site", array('@site' => variable_get('site_name', '')));
     } else {
         $message = t("A summary of all pages on @site", array('@site' => variable_get('site_name', '')));
         if (!empty($query['regId'])) {
             $term = culturefeed_search_get_term_translation($query['regId']);
             $message .= t(" in @region", array('@region' => $term));
         } elseif (!empty($query['location'])) {
             $message .= t(" in @region", array('@region' => $query['location']));
         }
         if (!empty($query['facet']['category_actortype_id'][0])) {
             $term = culturefeed_search_get_term_translation($query['facet']['category_actortype_id'][0]);
             $message .= t(" of the type @type", array('@type' => $term));
         }
     }
     return $message;
 }
 /**
  * Translates the categories.
  */
 public static function translateCategories($items = array())
 {
     $tids = array();
     foreach ($items as $item) {
         $categories = $item->getEntity()->getCategories();
         foreach ($categories as $category) {
             $categoryId = is_object($category) ? $category->getId() : $category;
             $tids[$categoryId] = $categoryId;
         }
     }
     // Translate the labels.
     if (culturefeed_search_term_translations($tids)) {
         foreach ($items as $item) {
             $categories = $item->getEntity()->getCategories();
             foreach ($categories as $category) {
                 if (is_object($category)) {
                     $category->setName(culturefeed_search_get_term_translation($category->getId()));
                 }
             }
         }
     }
 }
Exemplo n.º 3
0
 /**
  * Gets a page description for all pages.
  *
  * Only type aanbod UiT domein, theme and location need to be prepared for search engines.
  *
  * @see culturefeed_search_ui_search_page()
  *
  * @return string
  *   Description for this type of page.
  */
 public function getPageDescription()
 {
     $message = "";
     $query = drupal_get_query_parameters(NULL, array('q'));
     // Set prefix of the meta description based on entity type
     if (empty($query)) {
         $message = t("A summary of all events and productions");
     } elseif (!empty($query['facet']['type'][0])) {
         if ($query['facet']['type'][0] == 'actor') {
             $message = t("A summary of all actors");
         } elseif ($query['facet']['type'][0] == 'event') {
             $message = t("A summary of all events");
         } elseif ($query['facet']['type'][0] == 'production') {
             $message = t("A summary of all productions");
         }
     } elseif (!empty($query['facet']['category_actortype_id'][0])) {
         $message = t("A summary of all actors");
     } else {
         $message = t("A summary of all events and productions");
     }
     // Add additional facet information to the meta description
     // Only needed for indexable paths, see culturefeed_search_ui_set_noindex_metatag()
     if (!empty($query['voor-kinderen'])) {
         $message .= t(" for kids");
     }
     if (!empty($query['facet']['category_actortype_id'][0])) {
         $term = culturefeed_search_get_term_translation($query['facet']['category_actortype_id'][0]);
         $message .= t(" of the type @type", array('@type' => $term));
     }
     if (!empty($query['regId'])) {
         $term = culturefeed_search_get_term_translation($query['regId']);
         $message .= t(" in @region", array('@region' => $term));
     } elseif (!empty($query['location'])) {
         $message .= t(" in @region", array('@region' => $query['location']));
     } elseif (!empty($query['facet']['category_flandersregion_id'][0])) {
         $term = culturefeed_search_get_term_translation($query['facet']['category_flandersregion_id'][0]);
         $message .= t(" in @region", array('@region' => $term));
     }
     if (!empty($query['facet']['category_eventtype_id'][0])) {
         $term = culturefeed_search_get_term_translation($query['facet']['category_eventtype_id'][0]);
         $message .= t(" of the type @type", array('@type' => $term));
     } elseif (!empty($query['facet']['category_umv_id'][0])) {
         $term = culturefeed_search_get_term_translation($query['facet']['category_umv_id'][0]);
         $message .= t(" of the type @type", array('@type' => $term));
     }
     if (!empty($query['facet']['category_theme_id'][0])) {
         $term = culturefeed_search_get_term_translation($query['facet']['category_theme_id'][0]);
         $message .= t(" with theme @theme", array('@theme' => $term));
     }
     if (!empty($query['keyword'])) {
         $keyword = $query['keyword'];
         $message .= t(" with keyword @keyword", array('@keyword' => $keyword));
     }
     $message .= ". ";
     $message .= t("Discover what to do today, tomorrow, this weekend or later on.");
     return $message;
 }