You are here

function ParagraphsPackFeatureWebTestCase::check_paragraphs_select_element_existence in Paragraphs pack 7

Check paragraphs select element existence.

Return value

object Returns the paragraphs select element or FALSE if element wasn't found.

1 call to ParagraphsPackFeatureWebTestCase::check_paragraphs_select_element_existence()
ParagraphsPackFeatureWebTestCase::check_view_mode_options in tests/paragraphs_pack.test_helper.inc

File

tests/paragraphs_pack.test_helper.inc, line 104
Paragraphs pack content module's tests.

Class

ParagraphsPackFeatureWebTestCase
Class ParagraphsPackWebTestCase

Code

function check_paragraphs_select_element_existence() {
  $xpath_view_mode_name = '@name=\'field_pp_test_paragraphs[' . LANGUAGE_NONE . '][0][' . PP_FIELD_VIEW_MODE . '][' . LANGUAGE_NONE . ']\'';
  $xpath_view_mode = "//input[{$xpath_view_mode_name}]|//select[{$xpath_view_mode_name}]";

  // Get view mode field options.
  $elements = $this
    ->xpath($xpath_view_mode);
  $this
    ->assertTrue(!empty($elements), t('View mode options exists.'));

  // For non existing paragraphs select element return FALSE
  if (empty($elements)) {
    return FALSE;
  }
  return reset($elements);
}