Should I be editing BasepkContextCMSPageForm to add custom page settings?

1 view
Skip to first unread message

Spike B

unread,
Jan 12, 2010, 8:39:44 PM1/12/10
to pkcontextcms
Hi there Apostrophe community and P'unk,

For our website redesign at work I'm adding custom fields to the page
settings pane, and I'm curious just which files I should modify and
whether I should instead replace them with modified versions in my
apps/frontend/lib directory.

Specifically, I'm adding three fields at this time, with more perhaps
later:
* Page URL aliases (so /my-page/my-subpage can be aliased to /my-seo-
subpage and /my-short-url)
* Meta keywords
* Meta description

All of these are to give our marketing team greater power over the SEO
performance of the site.

It looks like I the page settings are originally defined in:
./lib/form/doctrine/pkContextCMSPlugin/base/
BasepkContextCMSPageForm.class.php

but should I modify this file directly, or modify one of the following
files:
./lib/form/doctrine/pkContextCMSPlugin/
pkContextCMSPageForm.class.php
./plugins/pkContextCMSPlugin/lib/form/
pkContextCMSPageForm.class.php

or copy one of those files and drop it into my ./apps/frontend/lib/
directory?

Also, I must modify:
./lib/form/doctrine/pkContextCMSPlugin/config/doctrine/schema.yml

to add the new fields, and then:
./symfony doctrine:build --all
./symfony doctrine:data-load

Or should I copy this schema.yml and drop it somewhere else, so it's
not overwritten if i do a svn up on the plugin externals?

Thanks for your help! Many more questions to come as I build this
into a fully featured site, but I hope that others will be able to
gain from these answers as well, as we all work to build Apostrophe
into the best PHP CMS around!

Thanks
Spike B

Tom Boutell

unread,
Jan 12, 2010, 8:57:17 PM1/12/10
to pkcont...@googlegroups.com
Hi Spike:

On Tue, Jan 12, 2010 at 8:39 PM, Spike B <oce...@gmail.com> wrote:
>    ./lib/form/doctrine/pkContextCMSPlugin/
> pkContextCMSPageForm.class.php

That's the one.

Never touch the plugins folder, not unless your intention is actually
to add features and commit them back to the public plugin, which is
something we can discuss if you're really on fire. But it's best to
test those features out in your application first, so see above.

> Also, I must modify:
>    ./lib/form/doctrine/pkContextCMSPlugin/config/doctrine/schema.yml
>
> to add the new fields, and then:
>    ./symfony doctrine:build --all
>    ./symfony doctrine:data-load
>
> Or should I copy this schema.yml and drop it somewhere else, so it's
> not overwritten if i do a svn up on the plugin externals?

You should be able to edit config/doctrine/schema.yml and add fields:

pkContextCMSPage:
columns:
foo: string(100)

And so forth.

Symfony cascades schema.yml files, so you're not crushing the
definitions of the normal fields, you're just adding one more.

--
Tom Boutell
P'unk Avenue
215 755 1330
punkave.com
window.punkave.com

Spike B

unread,
Jan 12, 2010, 9:09:55 PM1/12/10
to pkcontextcms
Thanks again Tom for the helpful answer.
Reply all
Reply to author
Forward
0 new messages