Skip to content

Cannot add attributes to Checkbox #126

Open

Description

@jrslv

It is currently not possible to add HTML attributes to checkboxes using {input foo, 'class' => 'bar'} Latte macro. The reason is getControl method of Checkbox returns a wrapper HTML object instead of the input itself.

Rewriting getControl method to

public function getControl()
{
    $this->wrapper = $this->getLabelPart()->insert(0, $this->getControlPart());
    return $this->wrapper;
}

at least fixes the ability to add attributes to the wrapper element (maybe this is disabled on purpose to avoid confusion). But anyway adding attributes to checkbox input elements is not currently possible.

Activity

  1. dg commented on Jun 21, 2017

    @dg
    Member

    Better way is to use <input n:name=foo class=bar>

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions