protected ViewExecutable::_buildArguments()
Builds all the arguments.
Return value
bool TRUE if the arguments were built successfully, FALSE otherwise.
File
- core/modules/views/src/ViewExecutable.php, line 1049
Class
- ViewExecutable
- Represents a view as a whole.
Namespace
Drupal\views
Code
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 | protected function _buildArguments() { // Initially, we want to build sorts and fields. This can change, though, // if we get a summary view. if ( empty ( $this ->argument)) { return TRUE; } // build arguments. $position = -1; $substitutions = array (); $status = TRUE; // Get the title. $title = $this ->display_handler->getOption( 'title' ); // Iterate through each argument and process. foreach ( $this ->argument as $id => $arg ) { $position ++; $argument = $this ->argument[ $id ]; if ( $argument ->broken()) { continue ; } $argument ->setRelationship(); $arg = isset( $this ->args[ $position ]) ? $this ->args[ $position ] : NULL; $argument ->position = $position ; if (isset( $arg ) || $argument ->hasDefaultArgument()) { if (!isset( $arg )) { $arg = $argument ->getDefaultArgument(); // make sure default args get put back. if (isset( $arg )) { $this ->args[ $position ] = $arg ; } // remember that this argument was computed, not passed on the URL. $argument ->is_default = TRUE; } // Set the argument, which will also validate that the argument can be set. if (! $argument ->setArgument( $arg )) { $status = $argument ->validateFail( $arg ); break ; } if ( $argument ->isException()) { $arg_title = $argument ->exceptionTitle(); } else { $arg_title = $argument ->getTitle(); $argument ->query( $this ->display_handler->useGroupBy()); } // Add this argument's substitution $substitutions [ "{{ arguments.$id }}" ] = $arg_title ; $substitutions [ "{{ raw_arguments.$id }}" ] = strip_tags (Html::decodeEntities( $arg )); // Test to see if we should use this argument's title if (! empty ( $argument ->options[ 'title_enable' ]) && ! empty ( $argument ->options[ 'title' ])) { $title = $argument ->options[ 'title' ]; } } else { // determine default condition and handle. $status = $argument ->defaultAction(); break ; } // Be safe with references and loops: unset( $argument ); } // set the title in the build info. if (! empty ( $title )) { $this ->build_info[ 'title' ] = $title ; } // Store the arguments for later use. $this ->build_info[ 'substitutions' ] = $substitutions ; return $status ; } |
Please login to continue.