Drupal multiple variables in block content

Basti

I am trying to print out multiple variables in a block content, but drupal returns:

Parse error: syntax error, unexpected '$search_field' (T_VARIABLE) in C:\seu\xampp\htdocs\iptp\sites\all\modules\custom\lasearch\lasearch.module on line 70

Here is my Code:

/**
 * Implements hook_block_view
 * 
 * This creates a block which shows the search results
 * 
 * @param type $delta
 * @return type
 */
function lala_search_block_view($delta = '') {
    $block = array();

    switch ($delta) {
        case 'lala_SEARCH_RESULT':

            $block['content'] = array(
                '#markup' => _lala_search_search_page(),
            );
            return $block;
            break;
    }
    switch ($delta) {
        case 'lala_lanavigator':
        $search_field = module_invoke('search', 'block_view', 'search');
        $search_text = _lala_search_get_laavigator('prefix');
            $block['title'] = t('la-Navigator');
            $block['content'] = $search_text $search_field['content'];
            return $block;
            break;
    }
}

I am new to PHP and I am britty sure that the problem depends on my syntax :-/

Michal

Try the following:

<?php
    $block['content']  = $search_text
    $block['content'] .= drupal_render($search_field['content']);
?>

This way drupal wil render the array for you.

Here is more info about it: https://drupal.org/node/26502

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related

Can I initialise multiple variables at the beginning of an if block using multiple functions with multiple return values?

Jest - import multiple tests in a describe block, reusing variables defined in beforeEach()

Restrict block visibility by page and content type in Drupal 8

PowerShell Add-Content with multiple variables to columns

Using a Content ID Contextual Filter in a Views Block in Drupal 8

How to validate HTML content with multiple variables put inside a string

Order by content in Drupal 7 module

Multiple Kernel#local_variables entries with block local parameters

how to declare multiple variables in one line in oracle plsql block

Changing url for the content in drupal

Include static HTML page under content of a drupal basic page. Can i make a block and include the static page?

Drupal make block as a big link

Drupal 7: add html block as field in content type insert/edit form

Drupal variables in region templates

JavaScript not Initializing in Drupal Block

Declare multiple variables in one line in Spock when: block

$content variable in drupal 7.(block.tpl.php)

Read string block as multiple variables ubuntu

Unexpected behavior when assigning multiple variables in if() block

bash: Join content of multiple variables

Drupal 8 - Block module as a webservice

Block content for passing variables from python to HTML

Dynamic modal content with multiple variables

Content Import Drupal

Drupal 8 filter or token to replace multiple patterns in a block of text

Terraform v12 Dynamic Nested Block with multiple content fields?

Drupal allow multiple users to add and modify content

extend the content of a block B into a block A

How to programmatically query the translated content of a block in drupal9