0

How do I programmatically get the content title field from a view?

screenshot

closed as too broad by kiamlaluno Feb 12 at 5:55

Please edit the question to limit it to a specific problem with enough detail to identify an adequate answer. Avoid asking multiple distinct questions at once. See the How to Ask page for help clarifying this question. If this question can be reworded to fit the rules in the help center, please edit the question.

1

Try with this out:
The following example with hook hook_preprocess_views_view

/**
 * Implements hook_preprocess_views_view().
 */
function myModule_preprocess_views_view(&$variables) {
  $view = $variables['view'];
  $result = $view->result;
  //- Titles Array 
  $titles = [];
  for ($i = 0; $i < count($result); $i++) {
    $titles[]= $result[$i]->_entity->title->value;
  }
}
  • you are welcome, glad that help. – berramou Oct 25 '18 at 16:48

Not the answer you're looking for? Browse other questions tagged or ask your own question.