przewiń do treści

Zend Framework od podstaw

Włodzimierz Gajda

$this->setOptions(array('id' => 'mojformularz'));

$this->addDecorators(array(
    'FormElements',
    array('HtmlTag', array('tag' => 'div', 'class' => 'abc', 'id' => 'def')),
    array('Form',    array('class' =>'xyz', 'style' => 'color: red'))
));

$this->imie
    ->addDecorator('HtmlTag', array('tag' => 'div', 'class' => 'klasa'))
    ->addDecorator('Label', array('tag' => 'p', 'class' => 'klasa2'));

$this->nazwisko->clearDecorators();
$this->nazwisko
     ->addDecorator('ViewHelper')
     ->addDecorator('Errors')
     ->addDecorator('Description')
     ->addDecorator('HtmlTag', array('tag' => 'em'))
     ->addDecorator(array('Drugi' => 'HtmlTag'), array('tag' => 'strong'))
     ->addDecorator('Label');

$this->setElementDecorators(
    array(
        'ViewHelper',
        'Errors',
        array('Description', array('tag' => 'p', 'class' => 'description')),
        array('HtmlTag', array('tag' => 'div')),
        array('Label', array('tag' => 'p'))
    ),
    array(
        'zatwierdz',
    )
);

Listing 29.10. Modyfikacja dekoratorów formularza

Rozdział 29. Dostosowywanie kodu HTML formularzy

listing-29-10.txt