texts: Position taxonomy header image field in template

texts:
I have a list of taxonomy terms to structure my content.

Apples
Oranges
Bananas

In admin/structure/taxonomy/manage/catalog/overview/fields I added the field_header_image (an Header image field). Now I am able to upload a term-specific Header image.

So if I go the url /apples/ my Apples Header image shows up.

How can I position field_header_image in my template?


texts: How can I get user_save() to update the nid instead of creating a vid?

texts:
I updated a node at hook_user_update() with this node object:

$node = new stdClass();
$node->nid = $f_node->nid;  // Updating
$node->title = 'TestT';
$node->type = 'employees';
$node->status = 1;        // Published?
$node->promote = 0;       // Display on front page?
$node->sticky = 0;        // Display top of page?
$node->field_employee_first_name['und'][0]['value'] = 'TestF';
$node->field_employee_last_name['und'][0]['value'] = 'TestL';
$node->field_employee_email['und'][0]['value'] = 'example@example.com';
node_save($node);

It executes without error but only my node_revisions (vid?) table is updated. The node table is untouched.

Am I missing something in the object that is keeping it from updating the node (nid) table?


texts: Why do I get the following errors when I install themes and modules on the website locally running on my Mac?

texts:
I'm just up and running and everything looks OK. Developing locally on a Mac with XAMPP, I have changed httpd.conf to suite my user and group, and FTP is OK. Now I want to install a new theme using "Install from a URL," but when I paste in the URL for my theme and click install, I get the following error:

  Warning: unlink(/Applications/XAMPP/xamppfiles/temp/update-cache-26f2422c/responsive-7.x-1.6.tar.gz) [function.unlink]: Permission denied in drupal_unlink() (line 2197 of /Applications/XAMPP/xamppfiles/htdocs/sandbox/cashbacon/includes/file.inc).
  Warning: unlink(/Applications/XAMPP/xamppfiles/temp/update-extraction-26f2422c/responsive/color/base.png) [function.unlink]: Permission denied in drupal_unlink() (line 2197 of /Applications/XAMPP/xamppfiles/htdocs/sandbox/cashbacon/includes/file.inc).
  Warning: unlink(/Applications/XAMPP/xamppfiles/temp/update-extraction-26f2422c/responsive/color/color-preview.png) [function.unlink]: Permission denied in drupal_unlink() (line 2197 of /Applications/XAMPP/xamppfiles/htdocs/sandbox/cashbacon/includes/file.inc).
  Warning: unlink(/Applications/XAMPP/xamppfiles/temp/update-extraction-26f2422c/responsive/color/color.inc) [function.unlink]: Permission denied in drupal_unlink() (line 2197 of /Applications/XAMPP/xamppfiles/htdocs/sandbox/cashbacon/includes/file.inc).
  Warning: unlink(/Applications/XAMPP/xamppfiles/temp/update-extraction-26f2422c/responsive/color/colors.css) [function.unlink]: Permission denied in drupal_unlink() (line 2197 of /Applications/XAMPP/xamppfiles/htdocs/sandbox/cashbacon/includes/file.inc).
  Warning: unlink(/Applications/XAMPP/xamppfiles/temp/update-extraction-26f2422c/responsive/color/preview.css) [function.unlink]: Permission denied in drupal_unlink() (line 2197 of /Applications/XAMPP/xamppfiles/htdocs/sandbox/cashbacon/includes/file.inc).
  Warning: rmdir(/Applications/XAMPP/xamppfiles/temp/update-extraction-26f2422c/responsive/color) [function.rmdir]: Permission denied in drupal_rmdir() (line 2361 of /Applications/XAMPP/xamppfiles/htdocs/sandbox/cashbacon/includes/file.inc).
  Warning: unlink(/Applications/XAMPP/xamppfiles/temp/update-extraction-26f2422c/responsive/css/layout.css) [function.unlink]: Permission denied in drupal_unlink() (line 2197 of /Applications/XAMPP/xamppfiles/htdocs/sandbox/cashbacon/includes/file.inc).
  Warning: unlink(/Applications/XAMPP/xamppfiles/temp/update-extraction-26f2422c/responsive/css/responsive-style.css) [function.unlink]: Permission denied in drupal_unlink() (line 2197 of /Applications/XAMPP/xamppfiles/htdocs/sandbox/cashbacon/includes/file.inc).
  Warning: rmdir(/Applications/XAMPP/xamppfiles/temp/update-extraction-26f2422c/responsive/css) [function.rmdir]: Permission denied in drupal_rmdir() (line 2361 of /Applications/XAMPP/xamppfiles/htdocs/sandbox/cashbacon/includes/file.inc).
  Warning: unlink(/Applications/XAMPP/xamppfiles/temp/update-extraction-26f2422c/responsive/favicon.ico) [function.unlink]: Permission denied in drupal_unlink() (line 2197 of /Applications/XAMPP/xamppfiles/htdocs/sandbox/cashbacon/includes/file.inc).
  Warning: unlink(/Applications/XAMPP/xamppfiles/temp/update-extraction-26f2422c/responsive/flexslider.css) [function.unlink]: Permission denied in drupal_unlink() (line 2197 of /Applications/XAMPP/xamppfiles/htdocs/sandbox/cashbacon/includes/file.inc).

The file permissions are already set to 777.


texts: Query to get termID, term name and number of posts that has that term

texts:
I can figure out how to construct a db query that fetches term id and term name. But how do I associate a count of nid's that has this term? I'm looking to do this programatically through the DB api.

Any help would be greatly appreciated, as I'm running low on time.


texts: Field Collection, with Entity Reference, can get value

texts:
I've got a field collection, which contains

A copy field
A user field, via entity reference

Now when I try to access the copy field by storing the collection in $collection, via

$collection->field_my_collection_copy->value();

I get what im looking for, but trying similar on the entity referenced field

$collection->field_my_collection_user->value();

It breaks. By looking into the variables for $collection->field_my_collection_user I should have 'uid' available on it, but $collection->field_my_collection_user->uid gives me nothing and $collection->field_my_collection_user->uid->value(); gives me Unable to get the data property uid as the parent data structure is not set


texts: Pathauto taxonomy term alias for content paths

texts:
I am trying to make my nodes URL aliases use taxonomy term aliases through Pathauto, but I cant seem to figure it out if there is an alternative.

For example, I am trying to use questions/[term:url:alias]/[node:title], but I am getting an error because taxonomies are not in content patterns.


texts: How to force a theme to use a sitewide custom menu

texts:
Ok so Im coming from wordpress where I could just hook a menu into the header of every page and create my own custom menu. I'm trying to do the same with drupal but it's so confusing! Im building my own custom theme so if I can start small with this question. How can I insert a sitewide menu with a custom template onto every page of the site. Something like this.

<div id="top-menu">
   <---hooked in functions from the template.php--->
</div>


texts: How to hide purchased commerce product with Panels visibility rules?

texts:
Goal:

I want to hide the panel pane containing a view (containing a product display) when the user has purchased the product.

Set-up:

I have a commerce product entity (not display) which is flagged using Rules on behalf of the user who purchases the product. I've created a view to verify the rule and it works, linking the Prod ID to the User ID correctly.

I then have a view:

View type: 'Content Pane'
Filtered on: 'Content type: Product Display'
With a field 'Content: Product Reference' with 'Add to Cart line item type : Commerce node checkout'

The view is displayed in a panel pane and appears as a standard 'add to cart' button. This is also ok and users are able to purchase the product, (which then provides a link to some premium content).

The problem:

In panels, I have a visibility rule on the pane containing the 'add to cart' button. The visibility rule looks for the flag attached to the product and shows it only if the flag is NOT there.

However, the product is always visible.

I've also tried the same procedure, but flagging the 'product display' instead, but with the same result.

I think it's probably that I'm not using the right context or relationship, either in views, panels or both. I've tried a few, but am now at the stumbling in the dark stage. I'm pretty stumped as I thought panels visibility rules would only offer options that were available/in scope. Any help/guidance much appreciated!

EDIT after comment #1 below:

I've added some screen grabs of the panels settings and output.

1 Panels content screen. Top-right panel shows two ways I tried to put the "add to cart" button in. The views method works, the direct panels method does not.

2 Relationships in Panels. I thought this would make the correct entities available to visibility rules, etc. but apparently not.

3 Panels output. The main content (overriden node type) is at the bottom. The "add to cart" button is on the right, and should only appear before purchase, but is always there. The contact details (left) should, and does, only appear after purchase.

4 Very brief diagram of entity relationships.

Further to the orginal description, the following might be useful:

Content access module with per-node access control is used to control access to "Contact details" content.
There is an option in visibility rules that can base visibility on access of current user to a particular bit of content, which I have tried, and seemed to target the correct content, but didn't work (so obviously wasn't).
This suggests to me that it's a matter of getting the correct vars in scope using panel contexts.


texts: I've a drupal 8 website, where in every page, I would like to add a noscript tag for every script tag. In drupal 8, in html.html.twig, I saw the scripts variable in missing. So how do I do that in Drupal 8?


texts: How do I find out which what fields are available?

texts:
I'm looking to access the values of the fields in postSave().

public function postSave(WebformSubmissionInterface $webform_submission, $update = TRUE) {
  //what's in $webform_submission? can I use it to get field data that was saved/submitted?
}

How do I get which fields are available from $webform_submission? How do I access them?

I have a field whose machine name is *feedback_type. I need to access its properties from that function.

UPDATE

So essentially what I'm wondering is, is there a way to see the structure of the $webform_submission variable? so that I can retrieve the data that the user submitted? I'd prefer to be able to do a print of it whether that's to a file/log/etc. doesn't matter I'd just like to know the structure of the $message_submission and its fields.


texts: How to store value of variable if it is changed inside of ajax callback function?

texts:
I have a form with several ajax callback functions.
And I have a variable which should change its value inside these  callback functions.
Unfortunately, I have faced with a problem. Namely, I don't know how to store the value of the variable after change. Because after the callback function executed the value is lost.

There is a little example of code.

class MyForm extends FormBase {
    public $i = 0;

public function buildForm(array $form, FormStateInterface $form_state){
    ...
    $form['add_more'] = [
        '#type' => 'submit',
        '#value' => 'Add More ...',
        '#ajax' => [
            'callback' => '::addMore',
        ]
    ];
    ...
}

public function addMore(array &$form, FormStateInterface $form_state){
    ...
    $this->i++;
    ...
}
}

Here the variable $i doesn't increase its value whenever the button is being pressed.
Could you clarify, what should I do if I want the variable to increase its value whenever the button has been pressed ?


texts: Display all tokens programmatically? Trying to debug token

texts:
I'm trying to debug creating a token. How to programmatically create a custom token in a module shows me how to create them.

Is there a way to display all available tokens? I'm trying to test if my module actually created that token.


texts: How do I remove the Previous and Next links?

texts:
The Previous and Next button links are causing accessibility errors and I would like to remove them (don't really need them for what I am using them anyway).

Is there a way to do this?

The error message is the following one:

  This button element does not have a name available to an accessibility API. Valid names are: title attribute, element content.

I have managed to hide the links from being displayed, but the error messages are still there. All I managed to do is get the css to set the display to none. Is there a way to completely remove the links from the code?


texts: 3 columns with main content in front page

texts:
I am very new in Drupal and therefore I need your help please.

I would like to have 3 columns in my front page for the main content. Let's say the columns are: NEWS, EVENT and SPOTLIGHT.

When I create an article, I would like to be able to choose in which column I am going to publish the article. I need also to be able to theme the columns... How can I do this?

thank you.

Gilles


texts: Fatal error during add a field to a content type with a custom Field Type

texts:
I'm working on Drupal 8 and I create a custom field type so

When I tried to add a field to a content type Drupal give me this error

  Fatal error: Cannot redeclare class Drupal\any_to_show\Plugin\Field\FieldType\AnyToShowItem in /var/www/public/sites/all/modules/something/src/Plugin/Field/FieldType/AnyToShowItem.php on line 105

I'm confused because it suppose that the file is the definition and it says that I'm redeclaring the class, I search whole site but nothing.

I was grateful if somebody can help me.
thanks in advance


texts:
Is it possible to empty the cart with drupal commerce by visiting a url?

/cart/empty

Trying to create a test case for selenium


texts: Line item custom field value not be saved after update line item

texts:
I added a custom field into line item type, but it cannot be edit on order edit page. My environment: commerce_kickstart-7.x-2.22(With IEF 1.5 and the widget: Inline entity form - Multiple values)

Steps to produce this issue:

Add a "field_additional_information" text field on    admin/commerce/config/line-items/product/fields, Do not include it on    "add to Cart from".
Switch widget line item manager into inline entity form - multiple values.
Edit order on admin/commerce/orders/%commerce_order/edit, click "Edit" link to edit a line item, "field_additional_information" field is shown, fill something in it.
Reopen admin/commerce/orders/%commerce_order/edit page, click "Edit" link again, the value of "field_additional_information" field is not be shown(leave blank). Check database, the value is not be saved.

Many problems on Drupal Commerce make me distracted recently. Any comment or help would be appreciated, Thanks!


texts:
For the second time in a short while my files/ folder has been hacked. Permissions are set as 755 all accross the folder.
I tried to set it up as 750, 754 but it breaks the website.

What happens is that someone manages to upload files in the imagecache subfolders. The first time an html file was upload for phishing. The next time a imagecache genrated thumbnail was replaced by an other image.

Can you give me hints on where to look at to fix this?

Thanks,
Chris


texts: How to make block title words themable in D6

texts:
I need to have my block title for Newsletter Signup block appear like this:

Sign up for mail

Note: Sign up = red colored font
for mail = blue colored font

Please help, I know how to override a block.tpl.php file, but I am not sure what my code would be to separate the word groups and add a div or span.


texts: Changing workflow status programmatically in Drupal 7?

texts: It appears that though Drupal 6 offered workflow_transition(), that function is not available for Drupal 7. Is there an equivalent? If not, what else are we supposed to use?


texts:
I'm using Drupal 7 and Webform and I want, remember input texts on next submissions for registered users.

How can I do it?


texts: How to detect a mobile browser using PHP in content?

texts:
Using Drupal 7.14 with the PHP filter on I have the following in a Basic Page content type:

<?php if ($is_mobile == TRUE):?>

<?php else: ?>

<?php endif; ?>

I get the error message:

Notice: Undefined variable: is_mobile in eval() (line 1 of D:\websites\modules\php\php.module(80) : eval()'d code).

I sort of understand - I'm trying to grab a variable from the Drupal system but is there any way to do this? Maybe using Tokens?


texts: How to modify .htaccess to serve brotli compressed static assets over gziped ones?

texts:
I'm trying to use brotli compressed static assets with Advanced CSS/JS Aggregation as detailed here, https://www.drupal.org/node/2773807. The assets are created as they should be, but they're never served because the .htaccess file doesn't know to do that.

lyncd.com has a short walkthrough, https://lyncd.com/2015/11/brotli-support-apache/, but I haven't been able to munge their code into Drupal's.

Here' the lyncd.com example:

    FileETag None

    <Files *.js.gz>
      AddType "text/javascript" .gz
      AddEncoding gzip .gz
    </Files>
    <Files *.css.gz>
      AddType "text/css" .gz
      AddEncoding gzip .gz
    </Files>

    <Files *.js.br>
      AddType "text/javascript" .br
      AddEncoding br .br
    </Files>
    <Files *.css.br>
      AddType "text/css" .br
      AddEncoding br .br
    </Files>

    RewriteEngine On

    RewriteCond %{HTTP:Accept-Encoding} br
    RewriteCond %{REQUEST_FILENAME}.br -f
    RewriteRule ^(.*)$ $1.br [L]

    RewriteCond %{HTTP:Accept-Encoding} gzip
    RewriteCond %{REQUEST_FILENAME}.gz -f
    RewriteRule ^(.*)$ $1.gz [L]

And here's the 7.50 .htaccess bit:

    # Rules to correctly serve gzip compressed CSS and JS files.
    # Requires both mod_rewrite and mod_headers to be enabled.
    <IfModule mod_headers.c>
      # Serve gzip compressed CSS files if they exist and the client accepts gzip.
      RewriteCond %{HTTP:Accept-encoding} gzip
      RewriteCond %{REQUEST_FILENAME}\.gz -s
      RewriteRule ^(.*)\.css $1\.css\.gz [QSA]

      # Serve gzip compressed JS files if they exist and the client accepts gzip.
      RewriteCond %{HTTP:Accept-encoding} gzip
      RewriteCond %{REQUEST_FILENAME}\.gz -s
      RewriteRule ^(.*)\.js $1\.js\.gz [QSA]

      # Serve correct content types, and prevent mod_deflate double gzip.
      RewriteRule \.css\.gz$ - [T=text/css,E=no-gzip:1]
      RewriteRule \.js\.gz$ - [T=text/javascript,E=no-gzip:1]

      <FilesMatch "(\.js\.gz|\.css\.gz)$">
        # Serve correct encoding type.
        Header set Content-Encoding gzip
        # Force proxies to cache gzipped & non-gzipped css/js files separately.
        Header append Vary Accept-Encoding
      </FilesMatch>
    </IfModule>

With your powers combined we can make the web about 20% cooler!


texts: How to get list of installed/enabled modules ready for repopulating new site with drush module installation?

texts:
When doing drush pm-list I get a whole list of modules but too much info also, like this:

Mail               Privatemsg filter (privatemsg_filter)          7.x-1.4
Mail               Privatemsg Limits (privatemsg_limits)          7.x-1.4
Mail               Privatemsg roles (privatemsg_roles)            7.x-1.4`

I have to edit in notepad++ and run macros...

I want the module list, but ONLY drush module names X_Y

Is there a way to get a clean list like:

module_a
module_b
module_c

ONLY

And then can use it as:

drush en module_a module_b module_c


texts: How to add contextual fields to breadcumb links?

texts:
How can contextual fields be added to breadcrumb links?

For example, I have a hierarchical taxonomy vocabulary like this:

Animalia
--Chordata
----Vertebrata

On the Vertebrata page, the default breadcrumb looks like this:

Home >> Animalia >> Chordata

Each taxonomy term in the vocabulary has a "common name" field, so for Animalia it would be "animals", and for Chordata it would be "chordates". I would like the breadcrumb to look like this:

Home >> Animalia (animals) >> Chordata (chordates)

A similar example can be seen on this page, where a taxonomic rank field appears after each link in the classification breadcrumbs.

Besides achieving this with taxonomy breadcrumbs, I would be interested to know if a similar solution is achievable for menu breadcrumbs generated by the Menu Breadcrumb module.


texts: How does a user subscribe to a group with GCC?

texts: I have the Groups, Communities and Co (GCC) module installed [7.x-1.0-beta2] but I cannot find a way for an authenticated user to subscribe themselves to a group. I have moved the 'GCC Subscription block' so that it's in the sidebar but whatever I do it's still not visible to any user. Has anyone else run into this, probably very simple, issue and found a solution?


texts: Exposed filters in Block for Page View do not filter results

texts:
I have below content types with following related fields setup in a Drupal7 setup.

Activity
    Fields: Name, Body and Image.

Event Fields:

Date
Location: Term Reference for Taxonomy Location
Activity : Term Reference for Taxonomy Location
Organiser: Entity Reference for Organizer node (as 1 event will have only 1 organizer)

Organiser
    Fields:

Location: Term reference for Location taxonomy
Activity: Entity  Reference for node Activity.

I have setup a Page View named Experience, with Listing of Events on right sidebar and on left sidebar i want to display the Filters.

I have managed to Expose the filter with BEF, however these filters don't give any result after changing value. Though they are set to Use Ajax.

Also other filters like Organiser and Location are autocomplete fields, these fields do not show-up any value on entering text.

Kindly help

UPDATE: Here's the SQL Query

SELECT node.nid AS nid, node.title AS node_title, node.created AS node_created, 'node' AS field_data_field_event_date_node_entity_type, 'node' AS field_data_field_event_image_node_entity_type, 'node' AS field_data_field_event_location_node_entity_type, 'node' AS field_data_field_event_amount_node_entity_type
FROM
{node} node
LEFT JOIN {field_data_field_event_club} field_data_field_event_club ON node.nid = field_data_field_event_club.entity_id AND (field_data_field_event_club.entity_type = 'node' AND field_data_field_event_club.deleted = '0')
WHERE (( (node.status = '1') AND (node.type IN  ('event')) AND (field_data_field_event_club.field_event_club_target_id IS NOT NULL ) ))
ORDER BY node_created DESC
LIMIT 12 OFFSET 0


texts: How would I apply a transition to a State Machine field?

texts:
I am trying to transition a state_machine field on the User entity during an event. What I have thus far is:

/* @var \Drupal\user\Entity\User $user */
$user = User::load($id);

/* @var \Drupal\Core\Field\FieldItemListInterface $state_field */
$state_field = $user->get('field_screening_status');

/* @var \Drupal\state_machine\Plugin\Field\FieldType\StateItemInterface $state */
$state = $state_field->get(0);

$transitions = $state->getTransitions();

$state->applyTransition($transitions['mark_needs_screening']);

Of course, this does not actually save it to the user. I would actually need to call:

$user->set('field_screening_status', 'needs_screening');
$user->save();

But, how might I instead use the state_machine API to apply the transition to a user field?


texts: Hide/Remove core simpleTests in Drupal 7

texts: I would like to remove the core tests that show up when I activate the Testing (simpletest) module. I have created my own tests for custom modules and I would like those to be the only testing options available to the user. How can I do this?


texts: Individually Print Exposed Filter Elements/Options

texts:
I'm using Better Exposed Filters on a view and want to individually print the elements/options within the 'widget', rather than all of them at once.

For example, lets say my options are: Red, Yellow, Green, White and Black, I want to be able to print Red, Yellow and Green in one , then White and Black in another.

From this:

To this:

The the template appears to only allow for an all or nothing approach:

    <div class="views-widget">
      <?php print $widget->widget; //this prints everything?>
    </div>

I imagine I could print the entire widget a number of times, then hide specific elements using CSS, but I feel this would create a a bit of a performance hit.

I've also tried separating options into different filters, but more than one exposed filter crashes my site as soon as the user selects options in more than one filter.


texts: Field-images wont be migrated in a migrate-upgrade --- Not sure if it's a bug

texts:
I try to Migrate-upgrade a D 7.44 site to D 8.1.3 and all seem to be migrated besides API images (i.e images uploaded in image fields).

Images uploaded in CKeditor with IMCE, on the other hand, appear just fine.

I am not sure if that's a bug because AFAIK, tens if not hundreds of sites were upgraded without that a problem.

Details that might help you conclude if this is a bug:

The D7 site files folder permissions is 755.
The D8 site files folder permissions is 777.
The node__field_image table in the D8 DB is empty (i.e zero rows).
The files path I gave in the Migrate UI module is /var/www/html/benia.biz/sites/default/files as in the first image here.
The second image describes a warning I saw while migrating and it might be associated to the problem. This warning deals with duplicated image paths, though I have no clue why it would appear.

Image1:

Image2:


texts: how to get the values of a view in _preprocess_views_view_fields drupal7

texts:
I have a view of multiple content types. I only select the name and an image from those content types so I'm sure what the format of output is going to be. how can I get the field values of view in MYTHEME_preprocess_views_view_fields?

kpr() function doesn't work here because for every content type there is a specific name for fields, say for content type A and B it is field_A_name and field_B_name.

thanks


texts:
I was looking for a solution to import RSS Feeds as nodes. We need to make modifications and add more fields to the content. This would have been easy in Drupal 7 with Feeds Importer, but it doesn't appear that there is a viable alternative for Drupal 8.

What would be the best way to import a feed directly to a node?


texts: How to copy data from one field to another in same content type using hook_update_N

texts:
Trying to copy data from field A (plain text field) to field B (entity reference field with taxonomy) within the same content type. The taxonomy terms used in field B are the same terms used in old field (field A).

Below is my first attempt in writing a hook for field copy (using hook_update_N) but its not working.

function mymodule_update_8001() {
   $node_type = "test_content_type";
   $nidArray = db_query("SELECT nid FROM node WHERE type = '%s' ", $node_type);

  foreach ($nidArray as $nid) {
    $node = node_load($nid);
    $termString = $node->field_a;
    $termObject = taxonomy_term_load_multiple_by_name($termString);
    $node->field_b->target_id = $termObject->tid;
    $node->revision = TRUE;
    node_save($node);
  }
}

Any help on this would be greatly appreciated.


texts:
I´m trying to theme my quizzes, but even when I did manage to theme the quiz nodetype (node--quiz.tpl), that template is gone after the "take the quiz" button is clicked.

I´ve tried theming the multichoice-answering-form.tpl (as my questions are all of the multichoice type), but nothing happens.

I´ve checked the quiz module and haven´t found a default template according to this need. Or maybe I´m missing something?

I´ve tried creating the template quiz-single-question-node.tpl, it seems that even when it is "taken" the content isn´t correct, because I get an  undefined variable error.

This is what I´ve try into that template, and didn´t worked out:

print drupal_render($form);
print render($form);
print render($content);

Whith any of the three options I get the same undefined variable error.

Any help will be very much appreciated. Thanks!!


texts: Which node table in Drupal 6 stores the node published date, created date timestamps?

texts:
I need to write a query to retrieve all nodes and their published dates for a Drupal 6 website and I would like to know which database table holds the nids and the timestamps. I am aware that there are 6 tables dedicated for storing info related to nodes.

I know about node_load but I do not want to use that?


texts: Create node via URL parameters to different drupal site

texts:
I am looking for a way to create a node via just a URL. I know the prepopulate module and similar can auto populate a form for a user to submit, but I would like to avoid the form altogether.

After a node on Site A expires I would like to allow users to add information about the expired node into Site B via email. So Site A will send out an email like:

  "Your listing has expired. Did you sell your product? If so, you can add that information to SITE B and view what others have paid for it. Just click the link below:

  http://siteb.com/field_location/Provo,Utah/field_category/Antiques/field_price/56.76>/etc..."

When the user clicks on the link, it will create a node with those values.

My main concern is spam prevention and validation.

Is there any module that would help with this? Prepopulate, Rules Link (Rules), Services, etc...

It doesn't have to be complex. It's only for one content type with only a few fields.

Thanks


texts: How do I block a user/cancel a user account in Simpletest?

texts: I'm trying to write some tests for a module for situations in which a user is blocked.  I know I can use drupalCreateUser() to make new users, but how do I block a user I have created in Simpletest?


texts: I want to make a custom search box but I only want to allow users to search in a specific content type. How can I do this?


texts:
In admin of the Commerce module, Orders (Store > Store Orders) are currently being sorted by 'order number' and I think "alphabetically" because they have a strange order like so:
842, 754...287, 146, 1370

How would I go about changing the default view to sort by 'Created' date to ensure that the latest orders are always at the top of the list?


texts: How we can get custom field type which will bring custom data from custom table to use as a drop down

texts:
I need to use my custom table data as a drop down.

for eg. i have created one custom table which is getting list of cities and i want that list to be shown in my form as a drop down.

Thanks in advance


texts: How to display Block content on menu click?

texts:
I want to display a block below a menu item (like a dropdown) when I click on the menu item. Specifically I want to use this way to display the search block when I click on the my search menu item.

Any suggestions about how to do this?


texts: Hide Webform Message "You are viewing this form as..."

texts:
How can I hide the message at the top of a webform which says
You are viewing this form as [user name]. Please click here if that's not you.


texts:
I've got some nodes which have different time value when I edit and display them.

13th November 2012 6 pm is the value that I input, however, when I tried to display that, it becomes 13th November 2012 7 am. My drupal time zone setting is Australia/Melbourne. When I output the whole array for displaying the time, the time zone value seems to be Australia/Melbourne as well. The array is:

Array ( [0] => Array ([value] => 2012-11-13 07:00:00 [timezone] => Australia/Melbourne [timezone_db] => UTC [date_type] => datetime ))

Has someone got some ideas?


texts: Panels, panel node print header and footer

texts:
I use Panels module and I've created Panel page, where I inserted Panel nodes.

Problem: Panel nodes have their own header and footer html tags that are printed. How to remove them? Any way to make it without custom template in code?


texts: Drupal 6 CCK date field is saving current time when the time field is left blank

texts:
I have a node type='event' that has a "text field with date popup calendar".  The date format is "05/13/2015 - 7:02pm".  On the edit page, the form renders as two fields: a calendar popup text field and a separate field for the time.  This field is mandatory; but, it has been requested that the time value not be mandatory.

The problem occurs when the node is saved.  It saves the date correctly; but, it inserts the current time if no time has been entered.   Is there a way to have it not enter a time or just default to midnight if no time has been entered?


texts:
I need to have two content type: "book" and "article".
Then I want to make a view that shows the title of the book (which is in the content type book) and the titles of each article (found in the content type article).  Which field should I add to the content type "article" to make sure it is plugged into a certain book? And how do I set the View?


texts: Howto pass the uid of a node to a view inside a dynamic display suite field?

texts:
I have 1 node of the content type "tourism" and 2 nodes of the content type "tourism news". All 3 nodes belong to the same author (uid 33).

The "tourism" content type has a dynamic display suite field "news" which includes the content pane of a view. This view should displays all "tourism news"-nodes depending on the uid of the requestet "tourism"-node.

When I enter the uid 33 in the preview, the view works as it should:

But when I open the "tourism" node - depending on my configuration - all news or no news are displayed. How do I have to configure the view and the dynamic field to pass the uid to the view?

Thanks in advance.


texts: couldn't load site name in html template

texts:
<?php print $site_name; ?>

Why I couldn't perform the above code in 'html.tpl.php'. This works find in page template. Please suggest how to load this in html template


texts: How do I filter basing on the vocabulary value?

texts: I am using the REST api to retrieve articles and some data related to  them. I managed to get the articles belonging to Red (which is a term of the taxonomy "color") using a view and contextual filters. Now I want to list all the terms of the taxonomy color without the articles .. The result must be Red, green, cyan , blue ... How can I do that?


texts: Get customer shipping information entered in checkout page, from shipping page

texts:
Following inline documentation on example shipping module api, I have an implementation of hook_commerce_shipping_services_info(), in which I set callback function for 'rate', 'details_form' etc.

I'm trying to calculate the rate based on the zip code entered by the customer, but the callback for 'rate' only takes two arguments, which are $shipping_services and $order. I dpm both objects, but didn't see any shipping information, entered on the previous page (checkout). The field [commerce_customer_shipping] has
Array
  (
   [und] => Array
     (
       [0] => Array
       (
         [profile_id] => 2
       )
     )
 )

How do I get the values for the individual fields, such as address, city, and zip code?


texts: Language cookie module not working in Safari?

texts:
I use language_cookie module to safe the users preferred language with a cookie. E.g. The default site language is English. But i am from Holland so i want always the Dutch version of the site: http://landberg.at/nl. But the cookie is not working on Safari MAC?

In Configuration » Regional and language » Languages i have:

URL (enabled)
Cookie (enabled)
User (enabled)

How can i make it work also for Safari?

(i use this module instead of IP redirect because with IP redirect you can not switch the language after you are redirected..? So the only solution in my opinion is to do it with a cookie. Or does somebody has another idea about this?).


texts: Update custom user fields programatically

texts:
how can I update custom user fields programmatically?

I've tried this but don't know how to get Id because I have to execute this code automatically on page load ..

$existingUser = user_load($uid);
$edit = (array) $existingUser;
$edit['field_company_name']['und'][0]['value'] = 'Ciklum';
user_save($existingUser, $edit);


texts:
I have a page content type with fields Title, Body and Blocks field collection with fields Title and URL.

It might be field collection, paragraphs or entity reference, it doesn't matter because all of these types require relationship in views in order to get its fields.

I need to generate a JSON output with views that look like this:

{
  'title': 'This is my title',
  'body': '
lorem ipsum dolor sit amet.
',
  'blocks': [
    {
      'block_title': 'Block one',
      'block_url': 'www.example.com'
    },
    {
      'block_title': 'Block two',
      'block_url': 'www.site.com'
    },
  ]
}

What I managed to achieve so far, is this:

[
  {
    'title': 'This is my title',
    'body': '
lorem ipsum dolor sit amet.
',
    'block_title': 'Block one',
    'block_url': 'www.example.com'
  },
  {
    'title': 'This is my title',
    'body': '
lorem ipsum dolor sit amet.
',
    'block_title': 'Block two',
    'block_url': 'www.site.com'
  }
]

This is Drupal 8. Any suggestions?


texts: Use redirect after content creating and use $node

texts:
I modified my submit handler to be redirected to a "thank you" page after creating some content. So far so good.

But I want to use some data of the node just created, so how can I transfer the $node-data of the just created node to my thank you page?

I created a new block to be shown only on the thank you page and I want to show some $node-data in my block...

function mymodule_block_view($delta = '') {
  switch ($delta) {
    case 'your_block':
      $block['subject'] = 'Share by mail';
      $block['content'] = mymodule_sharebutton();
      break;
  }

  return $block;
}

function mymodule_sharebutton() {
  $output = 'share';

  return $output;
}

I already tried with passing $node, $form, $form_state,... but with no luck.


texts: CSS not loading on Chrome for drupal site after moving to https

texts:
I have a Drupal site which has huge content. Recently I moved my dev content on production and also changed the site URL from http to https.
The problem is that the site is working fine on all browser except Google Chrome.
It is not loading the CSS. I can see the content but its without CSS.

I have the same setup for dev site and production site but still it is not showing any css.
If anybody has a solution please let me know.

Also I am using the same theme for dev and production.
In the site information it is showing the following message:

  This page includes other resources which are not secure.


texts: Webform Module Email - Module Specific Configuration

texts:
We've built a custom web form module to handle the capturing of contact information on our website. We recently came across the Webform module and are thrilled that it has so many different customization options that we're looking to transitioning over to using it across our entire site.

Before making this move we'd like to test it out using a single form on our site that captures some user data and sends it via an email submission. This data would not be stored within the Drupal database.

Our custom form module uses the Mail System and Swift Mailer modules to handle the sending of confirmation emails and we'd like to leverage the same modules when using the Webform module.

Within the Module Specific Configuration section of the Mail System module we've defined the following:

MODULE: Webform
KEY: ccpa_email_handler
FORMATTER: Webform PHP Mailer
SENDER: Webform PHP Mailer

I assume that the KEY value needs to be associated with the ID of the Email Handler that was defined for the Webform we've put built.

Unfortunately, when using the Test feature to see what the email looks doesn't seem to be working. When I submit the form I see the inline confirmation message but the email never makes it to my inbox.

I'm sure I've got something misconfigured here but I'm grasping at what it could be. I assume it has to be something with the Mail System and Swiftmailer setup so I'm hoping someone is also using this particular type of setup and could offer some insight as far as the setup and configuration.


texts: I'm using Mobile Navigation but does not load the dropdown menu after installing jQuery Update

texts: After installing the module jQuery Update not shown the Menú Mobile. Why?


texts: Use text field value on another text field on same node on save

texts:
I have two fields on a Content Type called Property that requires the same information and I am trying to have it so that it only needs to be inputted one time be the user.

I am using the module Address Field and Locations and need to fill out the zip codes with the same zip code. I need to get it so I only have to input the zip code one time and it fills both. I have tried a hook form alter (my example below) but the second field does not get the text unless I save the node again. I understand why but I am not sure how to go about fixing this.

function zip_to_zip_form_alter(&$form, $form_state, $form_id) {

switch($form_id) {

  case 'property_node_form':

$form['locations'][0]['#default_value']['postal_code'] = $form['field_address']['und'][0]['#address']['postal_code'];

  break;

}
}

Suggestions welcome. Thanks!


texts:
I'm using Views 3 on Drupal 6.

A while back I read an article how you can take your views and put it in your "custom' module folder (granted you've set this up for custom theme functions). I haven't had much need for it lately, but recently I've been doing a lot of work for a client that has needed a bunch of reworking of their Views and CSS related to them. This has turned into a bit of a nightmare trying to make sure that they then take my exported views from my development server to their server and import them correctly (sometimes they rename them, sometimes settings are not exported for whatever reason, etc).

A while back a read an article about converting your views into modules and it seemed pretty straight forward, but now I can't find it. Could anyone point me in the right direction? All I could find is a 50 minute long video tutorial, and I would rather just have an article I can skim.

Thanks!

EDIT:

The below link seems like it should work, but I'm not sure what I'm doing wrong. It just dumps all the views export code at the top of the page. What I did:

Put this into my "sitetheme.module"

function sitetheme_views_api() {
   return array(
      'api' => 3,
  );
}

Created this separate file named "sitetheme.views_default.inc". Which I put in this code:

/**
* Implementation of hook_views_default_views().
 **/
function sitetheme_views_default_views(){
  $files = file_scan_directory(drupal_get_path('module', 'sitetheme'). '/views',     '.view');
  foreach ($files as $filepath => $file) {
  require $filepath;
  if (isset($view)) {
 $views[$view->name] = $view;
  }
 }
  return $views;
}

Then I made a new folder in my sitetheme module called "views", took the export code and saved it something like "myexportview.view" and saved it under the "views" folder.

Then when I upload these files to the client server it just dumps all the code at the top of the admin/build/views page.

Any idea what I did wrong? I seem to be following the directions exactly but I'm not sure what I'm missing...

It appears that I had to put a <?php at the top of the myview.view export file. However, now Drush doesn't work... I get a fatal error from Drush when I try to clear the cache:

  Fatal error: __clone method called on non-object in /Users/mycomputer/Sites/mysite/htdocs/includes/common.inc on line 1733


texts:
I have a site running Drupal 6.30 which has started giving errors when it run the hourly call to cron.php.

The cronjob in question is and run as root:

0 * * * * wget -O - -q -t 1 http://example.org/cron.php

I get the following rather cryptic / truncated message when it runs

could not

I have looked in system logs and apache logs but do not see anything that would indicate reason for the problem.

Would anyone be able to suggest anywhere else I could look on the system to troubleshoot.

edit
additional logs from administer -> reports -> dblog around the time the cron fails.

1

mysql_connect() [function.mysql-connect]: Access denied for user 'mann'@'localhost' (using password: YES) in /var/www/example.org.org/includes/common.inc(1743) : eval()'d code on line 7.

2

in /var/www/example.org.org/includes/common.inc(1743) : eval()'d code on line 7.

3

mysql_select_db(): supplied argument is not a valid MySQL-Link resource in /var/www/example.org.org/includes/common.inc(1743) : eval()'d code on line 8.

4

Cron run exceeded the time limit and was aborted.


texts: I had my site for quite some time and just started to use the display suite view modes feature for changing the displays per node. I made new view modes and tried to change them for my nodes, but it seems that its just stuck on "default" view mode which is the full content view. I currently on display suite 7.1.x and updated to the latest as of Jan-2015 and it still does the same thing. Any hints would be great.


texts: Trying to create a new prebuilt list in webform

texts:
I'm attempting to define a new prebuilt list for our site, and even though everything looks like it should be fine, based on the examples I could find, the list doesn't appear.

My module is appearing in the list of modules, under "Other", and it is  enabled.

This is the content of the AddressList_webform_select_options.module file.

<?php

/**
 * Implementation of hook_webform_select_options_info().
 * See webform/webform_hooks.php for further information on this hook in the Webform API.
 */

function AddressList_webform_select_options_info() {
  $items = array();
  $items['Address'] = array(
    'title' => t('Select Address'),
    'options callback' => 'AddressList_options_Address'
  );
  return $items;
}

?>

<?php

/**
 * Build an options list for use by webforms.
 */
function AddressList_options_Address() {
  $options = array();
    $options[] = "1|city2 - Address1 - Floor - Building Name";
    $options[] = "2|city2 - Address2 - Floor - Building Name";
    $options[] = "3|city2 - Address3 - Floor - Building Name";
    $options[] = "4|city1 - Address4 - Floor - Building Name";
  return $options;
}

?>

This is the content of the .info file.

name = Address List
description = Creates a prebuilt list that contains all current addresses.
core = 6.x
dependencies[] = webform

Please tell me I'm missing something simple.


texts: How to expand trimmed body text to full body text in the same Views page?

texts:
I have a view in Drupal 7 where I am showing the node title and its body as trimmed text, as shown in this screenprint:

I need to show full body text after click on the Read more link, but in the same page. How can I do so?


texts: How to reference a image field and get it's file URI?

texts:
I have a paragraph type rn-accordion (rn-acc.html.twig), that has a entity reference revision to rn-accordion-section which houses a bunch of different fields. One of which is an image field (bp_image_field); however I am unsure how to reference this field in my twig file. So far I have tried:

but the output is always

Can someone help steer me in the right direction?


texts: How do I build the node title from field values when saving the node?

texts:
I have a content type (supertest) with the Category and Section fields, which are taxonomy term references. Every user has a Display name field.
I need to update the node titles when saving the nodes using [category] - [section]: [author.display_name] as format.
I've tried to add a rule, Display message action (just to test) on Before content save event, but it doesn't work. I can't figure out how to use the category field value to set the node title.
How can I make rules to change the node title?


texts: Shipping amount incorrect when hitting "Go back" on checkout

texts:
I am using Drupal Commerce with Commerce Flat Rate and I have setup various different rates depending on the total order amount.

The normal use case works as expected, however if I am at the shipping checkout pane and I hit go back,hit continue, and then arrive again at the shipping pane again, the shipping amount is recalculated based on the previously calculated (order_total + shipping_cost), not on the original order_total if you know what I mean.

What hook and code should I use to remedy this so that the shipping cost is based on the original order_total the second time around like it was the first time around?

Is it possible to remove the shipping component of the order total on the first checkout page?

Should I try to detect when I am on the first checkout page whether I arrived from the shipping pane, and so try to remove the shipping price component from the order total?


texts: LoginToboggan is not assigning new roles after validating email

texts:
LoginToboggan is not assigning new roles after validating the email. I've changed the token as it was in https://www.drupal.org/node/2003778 discussion. Now I'm getting: "Sorry, you can only use your validation link once for security reasons." error ,message if the user logged in.

even after clicking the link, if I logged out, it giving me the error "Sorry, you can only use your validation link once for security reasons. Please log in with your username and password instead now."

If I use my normal login details, it give me access but not assigning to the role I should.

Am I missing any settings/token perhaps?

I'm not a programmer, please make your ans details.

Thanks a lot


texts: How to get e-mail from Drupal.org about new Drupal releases?

texts:
I have creates a account in drupal.org website. I saw this https://www.drupal.org/news link to know news about drupal.

Is there a way by which I can get latest updates in my mail without visiting the drupal site


texts:
I'm using a block of code that shouldn't be displayed on certain content types (not blocks, but actual code). When I use this approach, I'm getting undefined variable and trying to get property of non-object errors:

<?php
    if(function_exists('views_get_page_view') && views_get_page_view() ||  arg(0) == 'user') {
      $showpage = "yes";
    }
?>

<?php if (((!empty($node)) || (!empty($showpage))) && (($node->type != 'article') && ($node->type != 'basic_page'))): ?>

(Show all this)

<?php endif; ?>

It's the check if the visitor is on a user related page that causes the errors, but I have no idea how to fix this. Can someone help me out?


texts:
I set Content is going to be saved for Rules Event.

And then the following code in Execute custom PHP code for Rules condition.
But it seems to return always TRUE no matter if the user account of node author is Active or Blocked.

return $author->status = 0;

How can I check the user status of node author  in Rules condition?
I would like the condition which returns TRUE when the the user status of node author is Blocked.


texts:
So basically i want to add a link to original node around each row in views. I have added the following code to the style and row template override in views. Both come up with the same result.

<?php $image = file_create_url($row->field_field_display_image[0]['rendered']['#item']['uri']); ?>

  <div class="block__inner" style="background-image: url('<?php echo $image; ?>');">
    <?php foreach ($fields as $id => $field): ?>
      <?php if (!empty($field->separator)): ?>
      <?php print $field->separator; ?>
    <?php endif; ?>

Now the issue that i am having is that the link is added to each field element that is outputted for some reason, and not just the link around the whole row and each field.

I cannot use custom field as that is making the same issue. It seems views is auto closing the a tag.

Any known workarounds?


texts: How to embed a view into the teaser of a node?

texts:
On the main page, I have a view that lists 3 items (3 boxes). One of them is linking to the news section. Right now, it's only a plain node and only the teaser is displayed on the front page.

If it's possible, I want to include the top 3 news headlines within the teaser of this node. Basically this will be a view inside of a teaser that is also listed to the front page by a view.

I might succeed with this method but I want to avoid using PHP as a text format. Should I just create a module and insert the view into the teaser by code? Is there a more convenient way?


texts: How to alter response headers from module hook

texts:
I am puzzled how to alter the response headers from specific hook (hook_file_download)?

/**
 * Implements hook_file_download().
 */
function example_file_download($uri) {
  $scheme = FileSystem::uriScheme($uri);
  if ($scheme === 'public') {
// Set custom headers here.
  }

}

Basically I want under certain conditions to set additional headers and in D7 this would happen with drupal_add_http_header() but in D8 as far as I can see this can happen only by implementing custom subscriber and using getSubscribedEvents and then KernelEvents. However this does not solve my case as I want to add custom headers only for specific file types.

If I use custom subscriber then this would be possible by:

/**
* {@inheritdoc}
*/
public static function getSubscribedEvents() {
$events[KernelEvents::RESPONSE][] = ['exampleFunc'];

return $events;
}

And then:

/**
*
*/
public function exampleFunc(FilterResponseEvent $event) {

$response->headers->set('Header', 'Value');
}


texts:
I need to put an id in menu links  i have this code from here https://api.drupal.org/api/drupal/includes!menu.inc/function/theme_menu_link/7.

function theme_menu_link(array $variables) {
  $element = $variables['element'];
  $sub_menu = '';

  if ($element['#below']) {
    $sub_menu = drupal_render($element['#below']);
  }
  $output = l($element['#title'], $element['#href'], $element['#localized_options']);
  return '<li' . drupal_attributes($element['#attributes']) . '>' . $output . $sub_menu . "</li>\n";
}

And have found the code i need but am struggling where to place it in the function. This code https://api.drupal.org/comment/45408#comment-45408:

l( t('Refresh Page'), $path . '/getdata', array(
              'attributes' => array(
                'id' => '',
                'class' => 'btn-small btn-primary '
              ),'query' => drupal_get_destination() , 'html' => TRUE)),

    );

Where would it go, i know what i need, but i am having difficulty doing it.

Thanks


texts: How to know which users/nodes failed to import in feeds logs?

texts: I'm trying to convert my implementation from the location to geofield modules. Not finding an easy way to convert the data, I tried the manual way which is to export the data to CSV and then repopulate the appropriate fields through fields. The issue is I have a lot of users, around a 1000, and the feeds log is just telling me that 44 of them failed. Is there anyway to know which ones failed? The feeds log doesn't give me a lot of diagnostic information, and manually checking is going to be a pain.


texts: How can I provide an autocomplete filter for tags in a Search API view?

texts:
I'm working to create a Search API view. I have an exposed filter that's a fulltext search filter. I'd like to expose another filter that works similar to the exposed entity reference, which allows users to reference multiple tags, separated by commas; the field will then autocomplete the entered value.

Is there a way to achieve this using the Search API Views and the Search API Autocomplete modules?  As far as I can see, there isn't a way to autocomplete multiple words/phrases, instead of just the first word/phrase.


texts: Having a hover or mouseover effect in views for drupal 7

texts:
I am creating a staff page for a project, and I am putting an image (suing views) that links to the staff members page.  What I thought would be really cool is if when you scrolled your mouse over the image it turned into the name of the person.  I am not sure at all how to do this, and after several hours of searching I need some help.

Thanks in advance.


texts: Where in the table is it stored that /drupal/foo is actually /node/47 in order to mass query to remove /drupal and just leave the /foo part?

texts: /drupal is broken on all the websites, but I want to go into the database and mass query to remove the /drupal and just leave the /foo part.


texts:
How can I update field values of all nodes via module?

I have a hook_cron function inside MYMODULE.module that updates field_popularity_score field of all nodes, of a particular type, so that I can use Views to sort the nodes by field_popularity_score.


texts: Services: which hook to use for altering node field values before calling the node retrieve service?

texts:
I have a custom formatter for a field
http://drupal.org/project/custom_formatters
but this seems to be ignored during node retrieve.

I also tried altering field value during hook_node_view, but no luck.

Do you have any tips on which hook node could I use to change the display of a field before retrieve?


texts: How to retrieve a query result in a computed field?

texts:
I'm trying to run the following select in a computed field, but it doesn't work: any clue on what is going wrong ?

$nid = $node->nid;

$result = db_query('SELECT description FROM {taxonomy_term_data} AS ttd
                    LEFT JOIN {taxonomy_index} AS ti ON ti.tid = ttd.tid
                    WHERE ttd.vid = :vid AND ti.nid = :nid',
                  array(':vid' => 16, ':nid' => $nid));

$entity_field[0]['value'] = $result;


texts: Changing the initial value of an exposed view filter

texts:
I'm trying to programmatically set the starting value of an exposed view filter (so that it initially loads the view with data matching that value).

I've managed to change the filter field value with this code in a views_pre_build hook (doesn't work in pre_execute or pre_render):

$view->display[$view->current_display]->handler->handlers['filter']['field_year_value']->value['value'] = $year;

But the view still loads with the value from the view filter's config value.  How can I get my change reflected in the view when it loads?


texts:
I'm moving from years after using joomla to drupal and i've hit the learning curve.

My question is below.

I want to create content like this:

Many shows
Each show has many episodes
Each show has many tags (genres)

Shows should be listable
Episodes should be listable per show
Shows should be listable per genre

It's basically a database for tv shows. But I want to hit the ground running.

I'm currently stuck with taxonomy and content types. Would a show and episode each be a content type? How can I relate them to each other?

I'm running drupal 7.x


texts: How to implement different landing pages for different countries?

texts:
How can I get Drupal 8 to use different landing pages for different countries?

I can create the pages but how do I tell Drupal which page to show for each country? Is geo location the only way, or is there another way?


texts: Problem with image width in views/ block

texts:
I have a problem to set image dimension on various position. I want a 300x100px in top, 100x75px for thumbnail and other dimensions on other place. In WordPress I can just add "width" attribute to set image width, also class. Example: //img src="location" width="100" class="myclass" alt="". In drupal I can't found how to set this.

I know, I can set in image style with various dimension but too many dimensions. I think, it will increase my hosting disk.

How to set width attribute on image in Drupal block/views like [img src="location" width="value"]?


texts: Where to add track_changes option in migrate_d2d class

texts:
I have an ongoing migrate_d2d migration where I will need to be able to
detect changes on a node by node basis, and I would really like to be able to
use the functionality in the Hash source rows to detect changes feature to
do that.  However, I can't find where to add that option so that the hashes
are generated. I've tried this is my class (that overrides
DrupalNode6Migration):

$this->sourceOptions['track_changes'] = TRUE;

but the option isn't added and used. According to this referenced post on this feature, I should add it in my source constructor, but that
part is handled by migrate_d2d in the abstract DrupalMigration class. Do I
need to go down to that level to create my class just to access this
property, or is there a way I can add it from my class that overrides
Drupal6NodeMigration?


texts: Problems Installing Colorbox Module "Requires: Libraries (2.x) (incompatible with version )"

texts: I followed the instructions and installed the Colorbox plugin, the Colorbox module, and the Libraries API module. For some reson, when I go to the Modules pages and try and enable the Colorbox module, it says Requires: Libraries (2.x) (incompatible with version ). Even though libraries 2.x has been installed. I can't figure out what I'm doing wrong.


texts: Serve 404 page on view with contextual filter?

texts:
We use facet filters to create collections of content. The facet filters create url arguments that look like this

www.example.com/l/language
or
www.example.com/l/language/g/gender

For SEO reasons we want to redirect any views page that doesn't return a result to a proper 404 page. All the solutions we've tried so far block the entire url, or they block the results. To work around this we tried using the contextual filter fix. It returned proper a 404 pages but also blocked our category content. We tried a few variations of contextual filter solutions and none worked. Our next attempt was some custom code View's path prevents 404 page from showing...

Our last attempt was to use the views 404 module, it returns a page with no results.

Is there another way to serve the content without using facet filter(URL arguments)? On the other hand is there a way to serve proper 404 pages without overriding our views results?


texts: Is it possible to create a variable price field where the user may enter any donation amount they like.


texts: Is it safe to remove this when I create a custom node?  It is not relevant to what I am doing.  Thanks.


texts: Is there a way to make image and text alternate between rows?

texts:
In Drupal theme, the content would have image and title which will have image on left and text on right in Display Suite under view in each row.

The client wants:
In first row, the image will be on left and text will be right. Next row, text on left and image on right.

Is there a module that can alternate between rows? Or display suite can do that?

Thanks


texts: How do I set the path alias for nodes imported via RSS feed?

texts:
In Drupal 8, I have created nodes of article type using the Feeds module, using a RSS feed as source.

How can I create path aliases for each of the imported nodes?

I have tried to map source:'item URL(link)' to target:'URL alias (path)', but it doesn't work as it includes the whole link (including http://) as path alias.


texts: Vocabularies don't appear when Taxonomy Access Control installed?

texts:
I have 3 Vocabularies called Country, Project, Research Communities. I installed Taxonomy Access Control module. I haven't configured it yet. But as soon as I install the module, if Anonymous or Authenticated user try to create a content, it doesn't show all the three vocabularies.
Earlier, when someone used to create a content, it used to show Country, Project, and Research Communities. User could select accordingly. But it doesn't show now.

Any idea?

EDIT 1: Taxonomy Access Control Configuration


texts: Looking for a little assistance. I have Drupal 7 up and running with the View and Date module. I'm attempting to build a content type where the only additional fields other than Title and Body are, Post Date and Expire Date. Setting up the view is easy but I can't seem to figure out how to make the view only appear with values between Post Date and Expire Date. Does anyone have any experiance setting this up this type of view?


texts: I have a problem with different image styles (thumbnails etc.) not being generated when uploading an image using image field on a node. The original image gets uploaded and works normally, but other styles don't.I am having this issue with Drupal 8.


texts: Get selected value from Dropdown list of views

texts:
I have a drop down list of different views for the users to select on a content type page in Drupal 7. I need to get the value of selected view from the drop down and display it in the form of selected view.

$value = $_GET['select id'];
$view = views_get_view('value');
print $view->preview('default');

I am not sure from where I should get the ID of the drop down field.


texts: How to embed views in a particular custom block template

texts: I have created a views block in D8 and thinking to embed it within a particular custom block template I created to override (e.g block--myblock.html.twig), I wonder how to do this ?


texts: How can I make sure a javascript cookie is set before page load?

texts:
I am setting a simple javascript cookie and checking it before firing a jquery ui dialog

(function ($) {
  Drupal.behaviors.setPopupConfig = {
   attach: function (context, settings) {
   if ($.cookie('modalServed') == null) {
    $.cookie('modalServed', 'yes');
    // build and show the dialog

I am adding the javascript with drupal_add_js in a hook_entity_load() in a module. In testing I've noticed that if I have a link element in the modal with a destination set to another place in the site with a potential modal dialog, the second dialog will fire before the cookie is set in the browser, which is not the intended behavior. I've tried adding weight and scope options to the drupal_add_js call, but it doesn't solve the problem. Is there another way to make sure the modal js only fires after the cookie is set?


texts: Drupal Gardens: is it possible to install a new theme?

texts:
I need to create a site into Drupal Gardens, but my client needs a custom responsive theme. I have searched in the FAQ and internal page of Drupal Gardens, but I have not found anything about this possibility.

Is there a way to install a theme for my site into Drupal Gardens?
Can I install some modules from drupal.org?


texts: Adding priced options to products in Drupal Commerce

texts:
For something that's pretty basic this seems overly complicated!  I'm working on updating a computer store from Ubercart to Drupal Commerce. Computers can be custom built so there are multiple options to choose. If I have to create a SKU for each variation I will go absolutely crazy!

So I've tried:

bundling modules - but they doesn't allow you to choose options
commerce pricing attributes - but it doesn't seem to work anymore "The "hunziker" approach to Drupal Commerce is not supported nor recommended by the creators of Drupal Commerce. Thus, any problems you might have with the modules is "by design" unfortunately." - Commerce Attribute price is not updating in cart
Commerce Customizable Products - seems the most promising but after following the "pizza store" video multiple times even with a clean install - everything works A-OK till the rules. When I get to the part where I am adding in the rules, I can add in the "Entity has field" part properly, but when I add the loop, I don't have the option for just "commerce-line-item:field-foo". It ends the commerce-line-item:field-foo with a colon and wants you to pick more. no matter what combination I try I end up with a rule error about lists: "Error: The data type of the configured argument does not match the parameter's list requirement".

I'm absolutely going nuts with this!! It shouldn't be this hard... should it?

The process I'm following for Customizable products is as follows (adding an Antivirus choice to a custom computer content type):

Install Customizable Products
Add a custom line item  Store > Configuration > Create New Line Item Type called “Custom Computers”
Create a Taxonomy, called "Computer Antivirus"
Add price field to taxonomy (with currency) called "Price" – Field Type “Price” > Currency CDN
Add a few taxonomy terms with prices
Add a Taxonomy term reference field "Computer Antivirus" to custom line item type, Store > Configuration > Line Item Types > Custom Computers

• Manage Fields

• Add new field “Antivirus” – Term Reference – Checkboxes

• Choose “Computer Antivirus” Taxonomy Vocabulary

• Include this field on Add to Cart Forms…

Set up products to use new line type. Configure the display of the add to cart form on the custom product type to use the custom line item type

•   Structure > Content Types

•   Choose Manage Display on the Content type you need to change

•   Edit the Product – Add to Cart form > Choose the Line item type “Custom Computer”

•   SAVE!!!

The custom options will now appear below the product
Change the price

•   Create a Pricing rule

•   Store > Configuration > Product Pricing Rules

•   Add new Rule named “Antivirus Rule”

•   Add a condition: Entity has field - Data Selector: commerce-line-item - Value: field_antivirus

•   HERES WHERE THE PROBLEM IS  - Add a Loop:- Data Selector: commerce-line-item:field-antivirus - Current List Item: change name

•   Add an action to the loop: - Commerce line item: Add an amount to the unit price - Amount Value: switch to data selection: pizza-topping: field-price:amount
 - Price Component Type: Fee - Value: Round the half up

I've been working with this about 4 weeks now with no solution. Can anyone shed some light on whats wrong?


texts: What modules do I need to implement web services?

texts:
We have planned to create a bank loan application in Drupal. The Application does not have any own users records, but it completely depends on external service provider.

For example, when we log in to the application, the username and password should hit the service provider, and fetch the result from the provider; the login information should be validated into the application.

How do I implement the web service in Drupal? What type of modules do I need to use?

I need to be able to do CRUD operations using web services.


texts: Which are the most effective methods of optimizing a drupal 7 site?

texts:
Is there any module which would help in optimizing drupal 7 site ?
The drupal site (used for bank both for transactions as well and for non transactions as well without using drupal commerce) becomes very slow in terms of loading pages or any nodes..
So which are different ways in which we can optimize the Drupal 7 site to work smoothly and efficiently?


texts:
I created a website with Drupal 8 in 4 languages. When I access a node in the default (English) language, I get to a page with a path of e.g. localhost/contact, just as it should be. Now, when I switch to Japanese, I would expect it to be localhost/jp/contact, but it is localhost/jp/node/13 (the page does display though). Both nodes have the same path listed (/contact) when I inspect them in the administration area.

For the record, my language detection methods are set in this order, in case it matters:

Account administration pages
URL (note: URL path prefixes are configured)
Session
User
Browser
Selected language

How can I achieve the expected state I mentioned above? That is, having the same (relative) paths set for each language variant of a node, while the language part of the URL would ensure displaying the proper language version of the node and while the URL would be human-readable and not just the node ID?


texts: how can i change the "Create new Account" to Custom registration

texts:
Is there any ways to add more fields in "Create new Account" ?

By defaults it provides only username and emailid.

So how can i add more fields like gender, date of birth.


texts:
In the main page I've got text "The front page". I managed to change that text but unfortunately I don't rembember appropriate place.

How can I remove that text?


texts:
To make certain actions simpler I'd like to know if it's possible to extend the node class in a way that allows you to add functions to the node class. What I mean is, I want to be able to perform actions like

$node->test();

or

$node->styledImage('field_name','style');

I was attempting to create it in a custom module like so

<?php

use Drupal\node\Entity\Node as BaseNode;

class AbleNode extends BaseNode {
    public function test(){
        return 'test';
    }
}

but then it dawned on me that this probably would only create a new type of entity that could give me those functions. It wouldn't actually let me perform these actions are preexisting nodes. Is adding functions to the node class possible, or even practical?


texts: Migration from a remote database PDOException

texts:
I'm setting up a database migration. For now, I'm using the ssh tunnel to access the remote databse.

Here is the configuration in the Migration class:

<?php
...
Database::addConnectionInfo('for_migration', 'default', array(
  'driver' => 'mysql',
  'database' => 'database',
  'username' => 'user',
  'password' => '****',
  'host' => '127.0.0.1',
  'port' => '1000',
  'prefix' => '',
));

// Conect to the remote $databases
$query = Database::getConnection('default', 'for_migration')
    ->select('Content', 'ct');

// Better descriptions for wineid and name; best_vintages is added in prepareRow()
$source_fields = array(
  'id' => t('article ID'),
  'contenido' => t('Contenido'),
);

// Create a MigrateSource object, which manages retrieving the input data.
// Tell the source class not to try to join the map table.
$this->source = new MigrateSourceSQL($query,
    $source_fields,
    NULL,
    array('map_joinable' => FALSE)
    );

$this->destination = new MigrateDestinationNode('article');

$this->map = new MigrateSQLMap($this->machineName,
    array(
        'id' => array('type' => 'int',
                           'not null' => TRUE,
                           'description' => 'Article ID',
                           'alias' => 'id',
                          ),
        ),
        MigrateDestinationNode::getKeySchema(),
        'for_migration'
    );

// @todo Mapped fields
$this->addFieldMapping('body', 'content');
?>

When I try to access the migration UI page the count of items is correct, but I get and error when I try to load the task page to visualize the mappings and elements.

DOException: SQLSTATE[42000]: Syntax error or access violation: 1064 You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'FROM Content ct LIMIT 1 OFFSET 0' at line 1: SELECT FROM {Content} ct LIMIT 1 OFFSET 0; Array ( ) in MigrateSourceSQL->fields() (line 211 of /Users/brightsitesSM/Sites/devdesktop/independentpoc-dev/docroot/sites/all/modules/migrate/plugins/sources/sql.inc).

Probably there is something missing in the code as the SELECT in the SQL query is empty.

Here are the screenshots of the migration page:

... and the task page error:


texts: How to prevent the results from being truncated?

texts:
I want to remove the limit of character imposed from Drupal 7 on the search result page. That is, displaying my result in full rather than truncating the results and adding ... at the beginning and end of the result. I already have a search-results.tpl.php in my templates and looks like that:

<?php if ($search_results): ?>
<?php print $search_totals.' << '.str_replace('%20',' ',basename($_SERVER['REQUEST_URI'])).'>>';?>
  <ol class="search-results test <?php print $module; ?>-results">
    <?php print $search_results; ?>

  <?php print $pager; ?>
<?php else : ?>

<?php print t('Your search yielded no results');?>

  <?php print search_help('search#noresults', drupal_help_arg()); ?>
<?php endif; ?>

How can I prevent the results from being truncated?


texts: How can I replace certain strings in variable table all at once?

texts:
I would like to replace all the 'aaaa' strings with 'bbbbbb' in value column of variable table.

I was initially trying to do that with just a simple query like this.

UPDATE variable SET `value` = replace(`value`,'aaaa','bbbbbb')

But this didn't work properly and I was taught that also the number between s: and :"  in value column has to be changed accordingly.

So variable_set seems to be the way to go but I'm not able to get it work.

https://api.drupal.org/api/drupal/includes%21bootstrap.inc/function/variable_set/6

How can I do this?


texts: Drupal\Component\Plugin\Exception\PluginNotFoundException after upgrading drupal

texts:
I tried to upgrade from version 8.0.x to 8.1.x. I used drush with the command drush up drupal.
The output shows some errors:
Do you wish to run all pending updates? (y/n): y
The "block_visibility_group" entity type does not exist.                                                                                [error]
Performing system_update_8200                                                                                [ok]
Performing block_content_update_8003                                                                                [ok]
Performing path_update_8200                                                                                [ok]
Performing views_update_8200                                                                                [ok]
PHP Fatal error:  Uncaught Error: Class name must be a valid object or a string in /Applications/MAMP/htdocs/drupal8.com/core/modules/field/src/FieldStorageConfigStorage.php:155
Stack trace:
#0 /Applications/MAMP/htdocs/drupal8.com/core/lib/Drupal/Core/Config/Entity/ConfigEntityStorage.php(189): Drupal\field\FieldStorageConfigStorage->mapFromStorageRecords(Array, Array)
#1 /Applications/MAMP/htdocs/drupal8.com/core/lib/Drupal/Core/Entity/EntityStorageBase.php(242): Drupal\Core\Config\Entity\ConfigEntityStorage->doLoadMultiple(Array)
#2 /Applications/MAMP/htdocs/drupal8.com/core/lib/Drupal/Core/Entity/Entity.php(507): Drupal\Core\Entity\EntityStorageBase->loadMultiple(Array)
#3 /Applications/MAMP/htdocs/drupal8.com/core/modules/field/field.module(181): Drupal\Core\Entity\Entity::loadMultiple(Array)
#4 [internal function]: field_entity_field_storage_info(Object(Drupal\Core\Entity\ContentEntityType))
#5 /Applications/MAMP/htdocs/drupal8 in /Applications/MAMP/htdocs/drupal8.com/core/modules/field/src/FieldStorageConfigStorage.php on line 155

After the update I just keep getting the following error on all pages:

The website encountered an unexpected error. Please try again later.
Drupal\Component\Plugin\Exception\PluginNotFoundException: The "page_variant" entity type does not exist. in Drupal\Core\Entity\EntityTypeManager->getDefinition() (line 133 of core/lib/Drupal/Core/Entity/EntityTypeManager.php).

I know this has something to do with the page_manager module. But actually I'm a bit helpless what I can try to resolve this problem. I even have no clue why this problem does occur. The page_manager module is still in the /modules folder.


texts: How do I populate an exposed filter with titles of user's content?

texts:
I have a view that displays all reviews written by a user. One piece of information that is included in these reviews is the band that the user was playing in at the venue that the review is for. So, I have an exposed filter on the view that allows people to filter reviews by band name.

 http://www.gigindie.com/users/jhegg23

However, the exposed filter renders as a text field. I'd like to change this into a select list containing the currently viewed user's bands. So, instead of the user typing in the name of the band that they want to filter the reviews by, they can instead select a band from the list. I know that I can alter the form type within a custom module, so that it renders instead as a select box. However, I also need to populate the options of the filter with the names of the bands that the user is in.

Bands are a content type of their own. Is there a way to do this, with maybe a view or something?

EDIT - As requested in the below comment:  It's D7, and it's a view of content (filtered by content type: review). The view is a block appearing in the user's profile, with a contextual filter for author UID from the page url. And yes, there is an entity reference. The user creates their bands, and then when they write a review, they select a band, which creates a reference in the review to the band.


texts: Form fields getting cleared off of user inputs after validation errors

texts:
This question is almost exactly my problem, but I'm not making the mistake made by that poster. As in, I'm not using #value to populate my fields, but the proper #default-value.

I'm working with ubercart, and the form I made is part of a checkout pane. Unfortunately, I have had to use drupal_get_form() within the main uc-cart-checkout-form as the value of a checkout pane. Otherwise, I cannot provide independent submit buttons or clump them together properly.

The problem is that after validation, the form fields are getting cleared out. Only the default values are being reset. I have tried writing a validation handler (even if actually the validation is taking place in a custom validation function that I'm calling from the hook_form_alter() of uc_cart_checkout_form)

Is doing this manually with SESSIONS the only way out? By calling a drupal_get_form inside a drupal_get_form, am I confusing FAPI irrevocably?


texts: Print the location or filename of an uploaded file from a custom content type

texts:
I'm trying to figure out how to print out the file path and the name of the file uploaded from a custom content type. I have my template all setup and everything printing how I need to, the last thing is I just need to be able to print out the path or at least the name of the file from the upload attached to the content.

I tried using:

{{ node.field_name.value }}
{{ node.field_name.url }}
{{ node.field_name.content }}


texts: How can I schedule a rule to always be run at a specific hour of the day?

texts:
I have a rules component that sends me an e-mail containing a view that contains certain statistics about my site.

I'd like to have this e-mail sent at midnight every day.

The rule looks like this:

Component: Action set

Send e-mail
Schedule the component again for evaluation (+1 day)

I then triggered the rule manually at midnight and waited for it to evaluate again.  This worked for the first several days but now the e-mail is arriving at 3 or 4 in the morning instead of at midnight.  I really want the e-mail to be sent at the same time every day (or as close to the same time as possible every day).  Is there a way to do this?


texts: Override title with field label instead of key inside a views contextual filter

texts:
I have a soccer team Drupal 7 site where I keep track of the players using a user role.  I have a view of the players which grids their profile pics and I'm very happy with it.  It's URL is /players

Now I want to divide the players into separate groups.  My first stab at this was to add a user_program field onto the User content type.  I added this field of type List(text), and gave it keys/values like:
youth_competitive_program|Youth Competitive Program
primary_competitive_programe|Primary Competitive Program

I then added a Contextual Filter so that I have /players/youth_competitive_program and such.  Works very well.  Except:  when I tell those views to override the title using %1 I get the key instead of the value.  What I really want is my human readable value up there, not the key.


texts: How to sort randomly two or more nodequeues in Views but keeping nodes position?

texts:
I've got 3 nodequeues:

Nodequeue A

Item 1
Item 2
Item 3

Nodequeue B

Item 4
Item 5
Item 6

Nodequeue C

Item 7
Item 8
Item 9

Does anyone know how to sort these nodequeues in Views (randomly) but keeping the nodequeue position of every node within its nodequeue?

For example:

Nodequeue A, Nodequeue C, Nodequeue B
Nodequeue B, Nodequeue C, Nodequeue A

But items inside every nodequeue stay, based on its original position.


texts:
Here is how the application is structured:

A cronjob runs every 3 hours making the Instagram Recent Media call -https://api.instagram.com/v1/tags/myhashtag/media/recent?access_token=ACCESS-TOKEN
If any new images have been posted on #myhashtag, then it creates a new article on the instagram content type
Finally a view(gallery) is built based on the images in this new content type. It displays the image's 'like' counter.

It was built this way to add moderation of images, so that when an image is unpublished, it wont show up in the gallery. The publish and unpublish aspect works through a tool page where there is an additional flag to remove from the queue as well.

Question is: Since the gallery view is based on the values stored on an instagram node in contenttype.
Is there a way to update the value for the likes count field without having to make a call to the API everytime any user goes to the gallery page?
 Otherwise the 'like' counts stored on the article become outdated.

Let me know if I can provide more info.


texts: How to change the value of the Submit button text when extending ConfigFormBase

texts: I need to change the value of the Submit button text when extending ConfigFormBase. What is the correct way to do it?


texts: Ctools Custom Content Type Plugin with Image Field

texts:
I was wondering if anyone has been successful with incorporating an Image field 'type'=>'managed_file' into a ctools plugin.  I created a custom ctools plugin but am having some difficulty with the image field as I am getting an error upon upload.  After some searching, it seems like this error could be caused from a file that isn't being included when the form is rebuilt after the ajax request. I've attempted to use the form_load_include to include the DRUPAL_ROOT/modules/file/file.field.inc file, and it is being loaded with the form, but I am still receiving this error:

Notice: Undefined index: content_image_pane_edit_form in drupal_retrieve_form() (line 763 of /htdocs/development/includes/form.inc).
Warning: call_user_func_array() [function.call-user-func-array]: First argument is expected to be a valid callback, 'content_image_pane_edit_form' was given in drupal_retrieve_form() (line 798 of /htdocs/development/includes/form.inc).
Notice: Undefined index: pane_image in file_ajax_upload() (line 271 of /htdocs/development/modules/file/file.module).
Notice: Undefined index: #suffix in file_ajax_upload() (line 280 of /htdocs/development/modules/file/file.module).

Here is my settings for my Custom Content Type Ctools Plugin:
/*Plugin definition*/
$plugin = array(
  'single' => TRUE,
  'title' => t('Custom: Content Image Pane'),
  'description' => t('This is a custom pane containing a title, textarea and image field.'),
  'category' => t('Custom Panes'),
  'edit form' => 'content_image_pane_edit_form',
  'render callback' => 'content_image_pane_render',
  'admin info' => 'content_image_pane_admin_info',
  'defaults' => array(
    'pane_image' => '',
    'pane_content' => '',
  )
);
/**
 * 'Edit form' callback for the content type.
 */
function content_image_pane_edit_form($form, &$form_state) {

  $form['#attributes']['enctype'] = array("multipart/form-data");

  form_load_include($form_state, 'inc', 'file', 'file.field');

  $conf = $form_state['conf'];

   $form['pane_image'] = array(
    '#title' => t('Image'),
    '#type' => 'managed_file',
    '#description' => t('Upload an Image that is associated with this content.'),
    '#default_value' => '',
    //'#default_value' => !empty($conf['pane_image']) ? variable_get($conf['pane_image']) : '',
    '#upload_location' => 'public://panes/',
    '#upload_validators' => array(
       'file_validate_extensions' => array('gif png jpeg jpg')
     ),
    '#array_parents' => array('pane_image')
  );

  $form['pane_content'] = array(
    '#title' => t('Content'),
    '#type' => 'text_format',
    '#format' => 'full_html',
    '#description' => t('Please enter the content for the custom pane here.'),
    '#default_value' => $conf['pane_content']['value'],
    '#cols' => 40,
    '#rows' => 6,
    '#resizable' => TRUE,
    '#required' => TRUE,
  );
  return $form;
}

If anyone could point me in the right direction for an answer to this that would be outstanding!


texts: How to merge two different pages on one page

texts:
I am using profile 2 module to manage users profile related information.
so far I am having two tabs

My Accounts
Customize the tabs takes me to two different URLs i.e
(mydomain.com/users/user-name/edit/Customize)(mydomain.com/users/user-name/edit/MyAccounts)

My question is,
can I make this into one tab and make these two different pages to display in one single page?

Thanks alot


texts: how to show contents tagged under a parent taxonomy term

texts:
I have contents that can be tagged per taxonomy terms (with hierarchies in content type), say,
Events > weddings
Events > birthdays
Events > public > national day celebration

The events (which is a vocab) actually turns into a menu (using taxonomy menus) and I want it so that when users click 'Events' menu all contents tagged weddings, tagged birthdays, tagged national day celebrations will show up on the page.

This content type (Events) has a field called 'Type' which is a hierarchical taxonomy list from the vocab 'events'. I had it set so that the term lineage will be save in the hierarchical select settings, I was under the impression that for any content tagged 'weddings' for example, this same content will also be tagged as 'events' by the system due to 'save term lineage' settings...

When I go to http://mysite/events (which i already configured using pathauto, and used views to display taxonomy terms related to nodes) none show up, as if none is being tagged 'events' at all. But when going http://mysite/weddings i get all contents tagged under weddings only (which is right).

Thanks!

EDIT: This content type (Events) has field called 'Type' which is NOT a hierarchical taxonomy list but a select list. Sorry for that.


texts: Adding nodes programmatically, specifying field columns

texts:
I am creating nodes using the below code.

$node = Node::create([
  // The node entity bundle.
  'type' => 'exercise',
  'langcode' => 'en',
  'created' => $ex->created,
  'changed' => $ex->changed,
  // The user ID.
  'uid' => $ex->uid,
  'title' => $ex->title,
  'field_lesson' => $nid,
  'body' => [
    'summary' => $ex->summary,
    'value' => $ex->body,
    'format' => 'full_html',
  ],
  'field_fret_text' => ['value' => $ex->frettxt,
                        'format' => 'full_html'],
  'field_intro' => ['value' => $ex->intro,
                    'format' => 'full_html']

]);

For the most part everything works, but the format column is not being set for my custom fields field_intro and field_fret_text; only the value is being set. I would have thought that specifying the columns as in the case with the body field would work.

How do I set the input format for those fields that are not the node body?


texts: Best database collation for multilanguage site

texts:
I’m running a  Multilanguage site (drupal 6) using  both: Latin language and  a no-Latin language characters.

Before the install. I used  phpmyadmin,  to change the default MySQL connection collation, from latin1_swedish_ci  to utf8_general_ci.
wondering if I'm doing things right? Or should I leave the  default MySQL  collation in latin1_swedish_ci ?


texts:
I've heard that using the php filter is dangerous. Something about having php in databases being a bad practice. I use it in blocks quite a bit and want to move away from that.

I have a lot of page template files so I need a replacement for regions/module_invoke blocks. I tried using an include but dealing with paths was tedious. Is that the only option or is there something easier?


texts:
I'm creating a widget with an image field. But I keep writing 0 to the database. But i need the fid to be saved. I know I can manipulate the data with hook_field_presave(). But the items array only contains image => '0'.

mymodule.module

/**
* Implements hook_field_widget_form().
*/
function mymodule_field_widget_form(&$form, &$form_state, $field, $instance, $langcode, $items, $delta, $element) {
...
  $element['image'] = array(
    '#type' => 'managed_file',
    '#name' => 'mymodule_custom_image',
    '#title' => t('Image'),
    '#size' => 40,
    '#description' => t(""),
    '#upload_location' => 'public://',
    '#theme' => 'mymodule_custom_thumb_upload',
  );
...
}

Edit:

/**
* Implements hook_field_widget_info().
*/
function mymodule_field_widget_info() {
  return array(
    'mymodule_polygone_widget' => array(
      'label' => t('Default'),
      'field types' => array('mymodule_polygone'),
    ),
  );
}

mymodule.install

/*
* Implements hook_field_schema().
*/
function mymodule_field_schema($field) {
  $columns = array(
    'image' => array('type' => 'varchar', 'length' => 255, 'not null' => TRUE),
    'zones' => array('type' => 'text'),
  );

  return array(
    'columns' => $columns,
    'indexes' => array(),
  );
}


texts: Drupal memcache problem - perhaps misconfigured?

texts:
I'm trying to configure memcache w/ my pressflow. I followed instruction from
Memcache API and Integration | drupal.org site yet whenever I'm trying to access /memcache.php to see stats, I always see Free is 100% and Used is 0%.

I'm not sure what to do to troubleshoot it? I know when I stop service and I try to access memcache.php it says it can not connect to server, so that part is working...

* UPDATE *

I did some testing of memcached itself by running /usr/bin/memslap --servers=127.0.0.1:11211 and that filled memcache by 4.64%, so this proves memcached itself is working as it should, now back to drupal's settings.php configuration: here is attached copy of lines that are related to memcache:

# grep \'cache_ /var/www/html/current/sites/XXX/settings.php
$conf['cache_backends'][] = 'sites/all/modules/contrib/memcache/memcache.inc';
$conf['cache_default_class'] = 'MemCacheDrupal';
$conf['cache_class_cache_form'] = 'DrupalDatabaseCache';
#

* UPDATE 2 *

this is part of installation's document:

The available memcached servers are specified in $conf in settings.php. If you do not specify any servers, memcache.inc assumes that you have a memcached instance running on 127.0.0.1:11211. If this is true, and it is the only memcached instance you wish to use, no further configuration is required.

... in my case this IS true, I only have one instance and it's running on 127.0.0.1:11211.

So there (I just specified what according to documentation I really shouldn't, and since I'm specifying memcache nodes, I'm going to include both of nodes. I'm able to telnet to both of nodes from either of nodes):

$conf['cache_backends'][] = 'sites/all/modules/contrib/memcache/memcache.inc';
$conf['cache_default_class'] = 'MemCacheDrupal';
$conf['cache_class_cache_form'] = 'DrupalDatabaseCache';
$conf['memcache_servers'] = array(
        '6app02a:11211' => 'default',
        '6app02b:11211' => 'default'
);
$conf['memcache_bins'] = array(
        'cache' => 'default'
);


texts: programmitacly get related nodes by terms

texts:
Im trying to get nodes related to a node in my module

i found https://api.drupal.org/api/drupal/modules!taxonomy!taxonomy.module/function/taxonomy_select_nodes/7

its only accepting 1 TID ... i mean 1 term for query related nodes

i want to pass all node terms and find related nodes by TERMS not TERM ... (some kind of aggregate query)

plz help


texts: How to embed my webiste Header(logo, menu) for each of my panel variant

texts:
I'am using Panel and I created several variant for many content type.

Is there a way to add my Top WebSite Header composed with (Logo, Main Menu, Second Menu, Search textbox, Language switcher and social network Icon) for each of my variant in a desired region.

Here is what I would like to do.

Create a kind of template called MyHeader where I would put any html element that I need for my Website Header(Logo, menu etc...).
If it's possible to create a template for MyHeader, how to do that ?

Use MyHeader into each variant panel, I would like to drag it into a specific Region , like dragging a simple widget.

Is it possible to do this.?

Note: I'm using Omega 4 as base theme for my subtheme

Sory for my english.

Thanks a lot.


texts: Filter criteria with entity reference field doesn't work

texts:
I have a field called event_author, which is a entity reference to user. These are the settings for the view.

They produce the following output.

After I add the filter, there is no result anymore. It seems the entity reference is not matching up with author1.

Why does it happen?


texts:
The Apache module PageSpeed provides various optimizations for HTML, JavaScript and such, which is great.

However, some of its features are redundant with Drupal's own aggregation and optimization methods. So has anyone tested which filters would be useful for a typical Drupal 7 website and which would be useless due to Drupal already providing support for it?


texts: TypeError: jQuery(“#mycarousel”).jcarousel is not a function

texts:
I added this jQuery function to my drupal7 header for jcorousel plugin.

<script type="text/javascript">

jQuery.noConflict();
(function($) {
    $(document).ready(function() {
        jQuery("#mycarousel").jcarousel({wrap: "circular"});
        jQuery("#mycarousel img").tooltip();
    });
})(jQuery);

</script>

However, this didn't work and I see this error in firebug panel:

TypeError: jQuery("#mycarousel").jcarousel is not a function
 jQuery("#mycarousel").jcarousel({wrap: "circular"});

I'm not sure how to fix this error and make my function work as supposed to.

NOTE: Add Plugin In->sites/all/themes/mytheme/theme.info this line => scripts[] = js/jquery.jcarousel.min.js this plugin included in my header, i see this.

EDIT: I Clear Cache From Admin Panel(admin/config/development/performance) And Fix This Error.


texts:
Possible Duplicate:
  How to remove format description in date_popup form field?

Hi I am creating a drupal 6 module and I have used drupal form API date popup fields to allow users to enter date. Everything is going on fine but I am getting a format description for date popup field as FORMAT 23/05/2012. I don't know how to remove this description.As shown in the image below


texts: how to block a user from publishing a node in drupal 7

texts: Please tell me that the user creates a node and he or she cannot publish that node on website and administrator can review that node and then the administer publish that node....


texts: How can I access the value of 'contacts' outside of the navigator.contactsPhoneNumbers.list()?

texts:
When I implement this code with DrupalGap, I want to access the value from the function in the navigator.contactsPhoneNumbers.list(), outside if it. I want to create a variable with the HTML table tags to the contact names and phone numbers of the contacts. The access the variable outside of the function.

contactCount ='';
navigator.contactsPhoneNumbers.list(function(contacts) {
   contactCount = "
Total contacts :" + contacts.length + "
";
}, function(error) {
   console.error(error);
});

alert(contactCount); // This does not shows any value.