texts: Change autocomplete results based users selected checkbox

texts:
I have a drupal 8 site that uses the paragraphs module. In one of the paragraph is a field that contains an autocomplete field. It is already set up to reference a small list of Content Types.  For example, "News, Events, Product, Image" are four referenced for the autocomplete.

On another paragraph, it includes this autocomplete but also has a field called "Select a Content Type", it lists out ALL the content types. This is used on the content type.  When someone adds a new content they are presented with a list of all the content types as a checkbox and the autocomplete field.

My goal is to only display the selected results from the "select a content type" field onto the autocomplete field.

So when a user selects a "news" / "events" / "Product" / "image" from the "Select a content type" field, the autocomplete only displays nodes of what was selected. If I select news then only news appears when I start entering data. If I select News and events, then both will show. If I select none then a custom message appears.

I have looked around and found how to overwrite getReferenceableEntities but I don't see a way to pass two variables: one from the checkbox field and the autocomplete entered value.

I suspect there will be JS involved to have the form send both checkbox and search value over but I don't know where to begin.


texts: How to make a form action attribute to a specific file

texts:
I'm making form in Drupal 7 website using php and trying to implement the under mentioned "action" attribute to the form. What i am trying to achieve is when the user clicks the submit button of the form the page should be redirected to page--generator.tpl.php in which the output of the form is shown.

This is what i am trying to achieve. This is the code from node.tpl.php, from where the user clicks the input and then print that input on the image on the next node i.e.page--generator.tpl.php

<?php
    if (!$is_front && $page ){
        echo"<form  method=POST action=".$base_url."page--generator.tpl.php>"
         ."<input id=post name=post_id type=hidden value=".$node_url."/>";
        if ($nid == 1){
        echo"<strong> Enter You Name <strong>"
         ."<input type=text name=input>"
         ."<input type=submit name=submit value=submit>";
        }

    else {
        switch ($nid){
            case 2:
            echo
         "<strong> Enter You Quote <strong>"
         ."<input type=text name=input>"
         ."<input type=text name=input>"
         ."<input type=submit name=submit value=submit>";
            break;
            case 4:
            echo
         "<strong> Hello Quote <strong>"
         ."<input type=text name=input>"
                 ."<input type=submit name=submit value=submit>";
         break;
        }
        }
         }
             ?>


texts: How to check user has permission special node

texts:
I following topic https://atendesigngroup.com/blog/custom-permissions-node-access-grants-drupal-8-and-drupal-7 to create custom permissions for node. It's working ok. Example I can edited node 1 with url: example.com/node/1/edit/. I wan't check user have permission edit node by code eg:

node_access('view', $node);

and Drupal 8

$node = Node::load(1);
$account = User::load(1);
$check = $node->access('edit', $account);

But It don't working. So how can check permission of special node?


texts: Exporting nodes except for specific fields

texts:
I'm wanting to transfer a set of content from one drupal site to another - the field structure etc is the same but there are a couple of requirements:

1) I need to be able export only nodes of a specific content type.
2) I need to be able to exclude certain fields from being exported.

I've had a look at a few modules - Node Export, Backup and Migrate - but these don't appear to handle the exclusion of certain custom fields.

Could anyone point me in the right direction of a module that can do this?

Thanks!


texts: Drupal 8 programmatical block can't be place in "Block Place UI"

texts:
I have been using drupal examples https://www.drupal.org/project/examples and developing my own examples for practice. But I have come against an issue I can't workout. Below is my link to the block code I have been developing.

d8 module block example on github

I can get the block to display under admin/structure/block, but when I press the "Display Block" button in the overlay I get no response can someone tell me why? See image

The error I am getting from the ajax call is

ajax.js?v=8.1.8:965 Uncaught AjaxError:
An AJAX HTTP error occurred.
HTTP Result Code: 200
Debugging information follows.
Path: /d8/admin/structure/block/add/pnc_block_test/pnc?region=-1
StatusText: OK
ResponseText:
Fatal error:  Class 'Drupal\Core\block\BlockBase' not found in /vagrant/src/d8/modules/custom/pnc/pnc_block_test/src/Plugin/Block/PncBlockTest.php on line 23

What I have trying to achieve is the following


texts:
I would like to make a field that is specific to a single user, similar to a
non-global flag but allowing more field types than just boolean. Is there a way to do this? For example, if User A sets this field on Node B to 5, then User C looks at that node, he won't see User A's value. If User C then edits the field to another value, then he will see that value instead, and User A will still see his value of 5.


texts: AJAXing radio buttons created by tableselect form api element

texts:
I am trying to AJAX a set of radios in a table to load/re-load a couple of additional tables when the user clicks the radio button. I am using the #type = tableselect to create the table. It appears the AJAX is firing (I get the throbber) but my callback is not ever being called.

Here is the relevant form code

$form['set_report_reports']['reports'] = array(
    '#type' => 'tableselect',
    '#header' => $reports_hdr,
    '#options' => $reports,
    '#empty' => 'No Reports Found',
    '#multiple' => false,
    '#ajax' => array(
        'event' => 'change',
        'callback' => 'show_users_per_report',
        'wrapper' => 'replace-me',
    ),
);

$form['set_report_reports']['access_tables'] = array(
    '#id' => 'replace-me',
    '#type' => 'fieldset',
);
$form['set_report_reports']['access_tables']['assigned'] = array(
    '#type' => 'tableselect',
    '#header' => array(
        'Name',
    ),
    '#options' => $users_with_access,
    '#empty' => t('No Persons with Access'),
    '#prefix' => '

Persons with Access
',
    '#suffix' => '
',
);
$form['set_report_reports']['access_tables']['add_selected'] = array(
    '#type' => 'image_button',
    '#value' => t('add'),
    '#src' => drupal_get_path('module', 'fsp_reports') . '/images/up_icon.png',
    '#prefix' => '
',
);
$form['set_report_reports']['access_tables']['remove_selected'] = array(
    '#type' => 'image_button',
    '#value' => t('remove'),
    '#src' => drupal_get_path('module', 'fsp_reports') . '/images/dn_icon.png',
    '#suffix' => '
',
);
$form['set_report_reports']['access_tables']['users'] = array(
    '#type' => 'tableselect',
    '#header' => array(
        'username' => t('Name'),
    ),
    '#options' => $users_with_no_access,
    '#empty' => t('No Persons Available'),
    '#prefix' => '

Persons Available for Access
',
    '#suffix' => '
',
);

And the callback function

function show_users_per_report($form, &$form_state) {
    return $form['set_report_reports']['access_tables'];
}


texts: How to fix views ajax problem when accessing via a proxy? (Browser Sync)

texts:
I am using a new theme called Neato which uses node.js to run gulp and Browser Sync.

For dynamic sites, Browser Sync has to run in proxy mode and the live preview is then displayed at http://localhost:3000/

However, this setup causes an error when configuring a view - as follows;

The page at localhost:3000 says:

An AJAX HTTP request terminated abnormally.
Debugging information follows.
Path: to view
StatusText: error
ResponseText:
ReadyState: 0

I find that the error happens when using a views modal, such as when configuring some row settings and occurs after choosing to save or cancel. It is not possible to update the view from this situation and the only way to close the modal is via (x) button.

The error does not happen when accessing the site in the normal way via localhost and only when using the Browser Sync proxy?

Can anything be done to allow trouble free use of views when accessing via a proxy and more specifically when using Browser Sync.

Possibly related (and quite funny) - https://www.drupal.org/node/1069800

Related Links:

http://www.browsersync.io/docs/options/#option-proxy

https://www.drupal.org/project/neato

I tried to add a tag for Browser Sync but don't have enough reputation.

Edit. Related drupal.org url corrected.


texts: During installation, the 'set up database' phase was skipped. Is that normal?

texts:
This isn't the first time I install Drupal 7 locally, but it is the first time that during installation the 'verify requirments' and 'set up database' phases were skipped.

I did have databases set up with the same name as the sites (testsite.localhost and testsite2.localhost). Is that why those steps were skipped?

I did look though the databases in phpmyadmin and it looks as though both installations were populated properly.


texts: EntityFieldQuery doesn't work correctly in hook_cron

texts:
I am programming a new module in my Drupal 7 project. in my module hook_cron is override.

in my hook_cron function, I want to select a node type with specific filter for a cck field.

I am using EntityFieldQuery in order to run a query.

my specific content type is "order_status"

here us the first code of query.

$query->entityCondition('entity_type', 'node')
    ->propertyCondition('type', array('order_status'))
    ->propertyCondition('status', 1);
$result = $query->execute();
dpm($result);

this code works with no problem. it collects all nodes with "order_status" content type that are published. (status is 1)

but when I want to add a new cck filter to the query it doesn't work.

I have defined some cck fileds for my "order_status" content type.

one of them is field_order_status_cr_confirm
type of this field is boolean (TRUE/FALSE or 1 | 0)

for adding a new filter to my above query I used this code.

->fieldCondition('field_order_status_cr_confirm','value',1,'=');

so my final query is

$query = new EntityFieldQuery();
$query->entityCondition('entity_type', 'node')
    ->propertyCondition('type', array('order_status'))
    ->propertyCondition('status', 1)
    ->fieldCondition('field_order_status_cr_confirm','value',1,'=');
$result = $query->execute();
dpm($result);

but this code doesn't work. it returns nothing. also I changed value of the field_order_status_cr_confirm to 1 but it still returns no data.

Do you know what my problem is ?

here is the dpm function result for one node of "order_status" type.

Please help me.


texts: google alerts RSS feed on homepage feed module

texts:
I am trying to import a google alert, which I have chosen to be a feed, onto the homepage of a drupal site I am creating.

The goal is to be able to automatically display the results of the rss feed but also to not publish everything right away as I would like to potentially screen the results before they are posted.

I just want to link to the articles respective webpages not necessarily store them as articles within our own drupal site.

I am trying out the module feeds http://drupal.org/node/622696

It might be a lot more than what I need but maybe the only available module. If you know of something better that suits my needs let me know.

I am new to drupal and this module required me to also install:

CTools
Job Scheduler

both of those were listed in the readme, but when I went to the modules admin page I was told I was missing:

features
views

So I went ahead and installed those as well. Is it normal that I had to install those even though they weren't included in the readme at all?

In any case.. I was able to import a feed but it seems to store all rss feed items as articles.

I also do not see any settings for setting how many posts should be visible, how much content should be shown right away (just want headlines). Although I may need to dig deeper into the code to change this stuff.

I guess what I am really asking is if there is a better/easier way to do what I want.


texts: Views Dynamic Fields checkboxes to dropdown select

texts:
I'd like to know if there is a way to modify the exposed check-boxes filter of Views Dynamic Fields module and convert it to a multi-select dropdown menu (like an ordinary exposed filter).

Unfortunately Better Exposed Filters module which makes that kind of modification possible, does not seem to apply on dynamic fields exposed filters.

Could anyone guide me how to make this kind of change on own?


texts: Getting the value of a user reference field and using it to display information about that user

texts:
I am quite new to module development although I have experience in modifying existing 6.x block modules developed by others. I have a need to develop a 7.x module and in spite of a lot of documentation reading seem to be missing a basic starting point. I have been looking at the documentation on drupal.org and other third party sites but through my own fault seem to be missing a basic concept.

The site I am working on has a content type called project. At present there are many project pages busing this content type. One of the field types is a User Reference field, called key_contact.

The idea is that I need to create a block that gets the key_contact's username (stored as an id number in the key_contact field) and then from that number perform an SQL query, on another table, to get the id's details and then display them in a block.

At present I have a View that can return the id and I have been asked to replace this view with a module that does the entire job.

Once I get the id for the key_contact I will have no trouble with the SQL query and formatting the output how I want it. I am familiar with creating a block module.

Where I am stuck is understanding how to get the key_contact value from the content type project page when it is loaded.

I would appreciate it if I could either be shown documentation or an example, or even an explanation, that will show me how to extract a field value from a content type like this.


texts: How to print a date field value on a page?

texts:
In Drupal 7, I have created a node type x,  with a date field D:M:Y. Here is an edited Devel tree array structure message for easy reading:

content >> system_main >> nodes >> 31 >> field_Mydate >> #items >> 0 >> value

Main question: How to print the particular node date field value from above extract? (page.tpl)


texts: Is there a way to remove a user's picture from the node, or the teaser without any CSS modification, but just doing it from the GUI?


texts:
I've used the Address Field module in my registration form with other fields. I've one select field to display some numbers and one textfield to get some numbers from users. This textfield should be required based on select field value. So I've handled this using '#states' in hook_form_alter. This is my code:

function arep_form_alter(&$form, &$form_state, $form_id) {
  if ($form_id == "user_register_form") {
    //field licence number is required only if profession is nurse
    $form['field_license_number']['#states'] = array(
      'required' => array(
        ':input[name="field_profession[' . LANGUAGE_NONE . ']"]' => array(
          array('value' => t('8')),
          array('value' => t('9')),
        ),
      ),
    );
  }
}

It is working fine, but I have another issue with the Address Field module. After changing country in address field, when I try to change select field value, '*' is added more than once.

I've tried to get $form_state['values'] after changing country in address field but it displays only empty values. So I can't make it work as I expected.

How to solve this issue?


texts: 7: How to cache $form[] elements in complex AJAX forms

texts:
How is it best to efficently rebuild your form on multiple AJAX requests?

That is how can I cleanly cache individual elements so I don't need to rebuild them?

Using static variables is not an option as they will not persist across form rebuilds. Using $_SESSION is probably the best, but this needs care as potentially a single session my have to windows open with diffent copies of the form in each one - and $_SESSION seems generally unclean.

Anyone got any best practices or boiler plates?

Background:
In order to AJAX in "proper" drupal style you need to rebuild the entire form on each AJAX call back. Your AJAx call back then just returns individual elements to replace. This is efficent for http bandwidth, but if the form elements are expensive to build this is potential an unneccessary performance hit.

The answer probably involves using $form_state somehow...


texts: Login via REST fails (403 forbidden) if cookie set by Drupal is kept

texts:
I am trying to login via an Ajax request. I don't need any fancy REST features, I just want to login. According to the docs and other questions here it should be pretty straightforward for Drupal 8.3.7:

 $.ajax({
    method: "POST",
    url: "/user/login?_format=json",
    dataType: "json",
    contentType: "application/json",
    data: { user: "myname", pass: "mypass" }
})

However, this doesn't work at all for me, as I always get a 403 forbidden response.
The funny thing is, I can get it to work in Postman (a third party tool for sending REST requests) but only under certain conditions. It works great in Postman as long as I don't submit the domain's cookie with the request. If I stick to the default settings and let it send the cookie I have the '403 forbidden' issues again. If I then manually delete the cookie all is well again for the next attempt (then it sets a new cookie and the next attempt will fail).

I assume I am having the same problem with the in-browser jQuery version of my request, but there I can not seem to get rid of the cookie so I can't get it to work. I have tried every answer provided in related questions (csrf token, jdrupal, basic auth, ...) but it's always the same issue if I make a request where cookie data is automatically attached by the browser.

Any ideas what is going wrong? Why is Drupal hating on the cookie data (which was set by Drupal itself!). Can authenticated users not use the login url anymore? Is it maybe because the /user/login page redirects to /user for authenticated users, so the request is sent to /user instead if you're already authenticated?


texts:
I am trying to build a Q&A / Ticket System with custom nodes.
the current status is:

Nodes:

Company: on the company node you get a link with "I want to ask a question"
Question: on the question node you get a link with "add comment"
Comment: on the comment node you get a link with "add comment"

Multiple comments create a thread.

The relation is made with Node Reference URL Widget. The question node has a reference to  company. The comment node has a reference to question.

I have 2 user roles:

Company
Clients

Companies can only react on questions and comments related to themselves. e.g. pcpower can only react on questions for them and not on those asked to pcworld.

How can this permission be accomplished. For now a company can react on all questions.

Clients: can ask questions to anyone (is working) BUT must only reply on comments/reactions on subjects created by them.

At this moment clients can make comment to any question or comment in the system.

Any help regarding to this would be really helpful.

Kind regards,
Jos


texts: Boost not caching anything. is_cacheable always set to false

texts:
I have the problem that my installed and correctly (I hope so) set up boost module isn't caching anything.
Turning on the debug mode, it always says is_cacheable = FALSE for every page - which would explain the behaviour.

There is no "is_cacheable_reason" flag set, but I found the part of the boost.module file where is_cacheable is set to false for me:

...
elseif (!drupal_page_is_cacheable()) {
$_boost['is_cacheable'] = FALSE;
return;

}

Its line 276 from the boost.module file - right in the function boost_exit().
drupal_page_is_cacheable() seems to be a native drupal function, but I don't know where drupal decides that no page should be cached.


texts: Disable Node's Show summary in full view in D6

texts:
In https://drupal.org/node/514318 it talks about how to disable showing the summary/teaser in full view mode but only for D7 it seems.

In my D6 based site, I've filled in meta-description in the node teaser as required by Nodewords module.

The problem is that in full view mode it is clubbing this node teaser with the node's body text. Is there any option to avoid it adding with the body content?

In the picture from dsm($form) in hook_form_alter when editing node we can see there is teaser_include array key with #default_value = TRUE. I'm wondering where in the Admin interface we can specify this setting.


texts: How to run drush tests from the command line?

texts:
I installed drush via composer, initially drush 8 was installed.

I then try to run tests via drush test-run command,unfortunately I get the following output indicating the command is not found.

  (16:38 vagrant@devbox .composer) > drush test-run help The drush
  command 'test-run help' could not be found.  Run drush cache-clear
  drush to clear the       [error]

Installing version 7 via composer gives same output. Clearing the drush cache did not help, am I missing something?


texts:
I’ve activated the search form block on my Drupal home page.

When a user enters a keyword and presses search button, I would like to redirect to the search page result.

How can I do that?


texts: How can I output custom html inlcuding js files

texts:
I'm trying to output a JS based frontend app through one controller action.

To achieve this I need this action to output a very specific html layout, inlcuding some js files.

As far as i know I can return a symfony response object to bypass drupals render stack, inlcuding themeing mechanism.
But how to deal with the js files that should be included? Right now they are located inside my module folder, and I definitly don't want to link to this location inside my custom html output.


texts: Drush 8.0.3 Failed to get available update data and simplexml_load_file warning

texts:
Please, can someone offer help with this error:

  drush dl simplexml_load_file(): I/O warning : failed to load external entity [warning] "" Project.php:74 Failed to get available update data from [error] https://updates.drupal.org/release-history/drupal/8.x Could not download requested project(s). [error]

I am using FreeBSD 10.2-RELEASE-p9 with PHP 5.6.18. My current Drupal sites work OK, but they need updating.

Drush installed OK
drush status PHP configuration : /usr/local/etc/php.ini
PHP OS : FreeBSD Drush script : /usr/local/bin/drush
Drush version : 8.0.3
Drush temp directory : /tmp
Drush configuration :
Drush alias files :

I can run commands like:

drush pmi

but I can't seem to connect and download anything from Drupal.
Your assistance would be appreciated.


texts: How do I export a content type, views as a single module

texts: I've a view, content type, field collection, flexslider to satisfy a single user case. May I know how to export all these three as a single module.


texts: How to filter content field in webform before sending?

texts:
I have an issue on how to proceed in creating a filter/alert for users (any user may send webform) on the content of the messsage through webform (using drupal 6).

Let say someone goes to the form and types XXX within the message. I want to not let the user send webform or delete that specific content if that word/link/set of words are typed in.

If you know how to do it you may contact me directly too


texts: How come my views suddenly take full width?

texts:
I don't know what I've changed but now 2 of my views are full width.
Here's 2 screenshots from a view how it was and how it is now.
How can I change this back to normal?


texts: Commerce - how do I set a discount to a specific user's next order only?

texts:
I'm making an e-commerce site for a friend.

The point of his shop is to sell honey in jars. When people return the jars, they get a 2 euro discount on their next order.

I've tried several things so far but if I give the user a discount, it continues to give the discount. I only want it the discount for the next order. Same goes for other ways I've tried it. I'm not quite sure how to set these specific conditions.


texts: Allowing anonymous users to contact node authors

texts:
I want anonymous users to send messages to node authors. Also I want the sent messages to be visible to node authors in their user account. Here is what I have tried so far:

Private message - Solves what I am looking for but does not work for anonymous users
Webforms - New to it but I don't see a way for node authors to access the sent messages within their account


texts: How to set a content type tile base on taxonomy field that user select?

texts:
I have ask in the past How to convert Content Type Title into Term reference?. Which someone suggest to used the Title Field UI in order to remove it the title and have a Term Reference field as my title field.

However, now I run into few problems where the title field is been expected like admin/page. So I was wondering if possible to set up the title field the same as the a term but automatically. I do not want the user re-type the field Title field, but at the same time I want to limit the user from choosing something that is not from the terms.

So how can I copy the taxonomy term that the user select and set up as title programmatically ?

Update 1

My content type machine name is job_per_template and taxonomy name is field_job_title_template. I have take the code from the answer below and I got this error.

  Integrity check for the imported configuration failed. Error message:
  The data type of the configured argument does not match the
  parameter's value requirement..


texts: How to translate the description, and abstract metatag for the front page in a multilanguage site?

texts:
I am using the metatag module. In admin/config/search/metatags I am controlling my metatags for my front page using Global:Front page. Here it is my configuration

How can I translate these metatags for other language. I can use tokens for the title but I don’t know how to translate the description, and abstract metatag.

Any solution for this?


texts:
I am trying to modify the CSS in a Drupal 7 theme from being statically coded to one which is generated by views.  The person before me, wrote the slideshow directly into the page--front.tpl.php file and this makes it next to impossible for users to change the slideshow without getting a Drupal developer involved.

In the "static" page, there are some tags which, due to my ignorance, I don't know how to deal with.  For exampe:

I know what the "id" is and I know what the "class" is, but I have no idea what the "u=" references.  I have also seen:

Can someone tell me the terminology associated with this tag so I can research it?  Typing in "<div u=" in Google is bringing up tons of unrelated results


texts: How do you make omega 4 choose a different layout depending on the screen size?

texts:
I have read all the omega 4 unfinished Documentation but I still don't understand how the layouts are chosen for mobile and tablet versions. I know I can create layout files that define page.tpl.php and that those can have stylesheets scss and so also css.

But I don't understand how to tell omega 4 to use layout phone.tpl.php when I arrive at the breakpoint for mobile phone screen sizes.

How do I define the layout for a specific screen size?

Context only gives me pages, views and such, but nothing about the screen size. The thing is I don't even need a different layout, I need different css (layout would be better zhough). Do I have to add includes in the sassy to only use css? Is it then overkill to use omega 4? And how do I go about it if I really do need a layout? What Controls which layout is being used for which resolution? Or am I doing everything wrong here?


texts: How to tell if the current revision is the original?

texts:
I want to display a different "Submitted by" message for content that has been updated, and thus has multiple revisions.

How can I tell if I'm on the original revision, or if there are multiple revisions?


texts: Submitting webform without refreshing the page

texts:
I have a webform displayed as a block:

Is it possible to submit the form without refreshing the page, followed by a message saying the webform has successfully been submitted? If so, could someone guide me in the right direction?

Thanks!


texts: After updating from drupal 6 to 7: No content types under node/add

texts:
I am updating a Drupal/Tripal site on a test system. When I try to add content after migrating core using /#overlay=node/add or /node/add I get:

You have not created any content types yet. Go to the content type creation page to add a new content type.

However, under content types it lists all my content types (page, article, blog, etc).
I notice that this looks very similar to
No content types showing under 'Add content'

but the accepted answer doesn't help me, because it is not about the state after a d7 update, and I don't know how to apply the steps in a d7 install.

The Navigation contains:
Add content
Blog entry
Book page
Forum topic
Page
Poll
RNAi
Story

Sub-type links like node/add/page work, still node/add lists no content types.


texts:
It would be great if anyone tell me how to disable EDIT Tab. I'm using Drupal 7.

I try with role permission, I successfully disable it for other submitter but failed to do the same for some submitter.

At the same time, I want that the submitter be able to change the workflow state, this is why i check all that permissions.

Thanks for the help.


texts: Price resolver and cookie cache context vs cart order item prices

texts:
I have custom Drupal commerce price resolver that changes the base price for a product based on the value of a cookie (or absence of one). The resolver adds appropriate cookie cache context to the purchaseable entity. For debugging purposes, cookie expiry is 5 minutes.

Prices are rendered by the Calculated Price Formatter, which adds the cookie cache context from the purchaseable entity to the render element metadata.

This works as expected anywhere the product variation price is displayed directly. When the cookie expires, the displayed price is reset.

But for order items in the cart (block, form or summary), which have a line price using the ORDER ITEM total rendered via the Calculated Price Formatter, the cached render element is not being expired with the cookie, and these continue to show the modified price until something else happens to force a cache rebuild.

Does anyone have any ideas about how to ensure the cookie cache context gets bubbled up and expired appropriately for order items with calculated prices that have cache dependencies?


texts: Get all fields for a given content type including title

texts:
I'm using field_info_instances($entity,$bundle) to read through every field in a given content type in their weighted order. However, field_info_instances does not include the node title. Why not and how can I remedy it so its added to the $fields array for sorting and processing in this scenario:

<?php
function do_something($content_type){
    $fields = field_info_instances("node",$content_type);
    usort($fields,"sort_stuff");
    foreach($fields as $field_name=>$value){
        do_something($value);
    }
}

function sort_stuff($a,$b){
    return $a['widget']['weight']-$b['widget']['weight'];
}
?>


texts: How do you give permissions to certain roles to get certain menu items to display in the admin_menu toolbar?

texts: Currently I'm using the admin_menu module and have certain roles restricted todo certain things. As an admin I can see the full admin_menu bar in full, but as a restricted user I can only see Add content. Since I'm running the commerce module, I only want certain roles to get the Store dropdown menu. Right now I only see Add content and I'm not sure where to go to enable it to show up in the admin_menu toolbar.


texts: Use Tokens and/or Replacement Patterns in Shortcodes

texts:
Looking for a way to add a token/replacement pattern into shortcode.

For example, creating a button where different text and link is required depending on other factors - something like the following:

[button link="mysite/[url replacement pattern]" text="[label replacement pattern]"][/button]

The main reason I need to do this is that I'm using view field views and want to replace an empty field with a custom button, contained in the 'sub view' when the view is empty, which needs to be different depending on what should be in the 'sub view' - I'm using shortcodes in with Global: Text Area in the No Results Behaviour (if that makes sense)

Unless, of course, anyone knows another way to achieve the same result.


texts:
Is it possible to make the pagination system numbering correspond to the page number you are on?

For example, instead of having /media-releases (page 1), /media-releases?page=0 (page 1), and /media-releases?page=1 (page 2) having /media-releases (page 1), /media-releases?page=1 (page 1), and /media-releases?page=2 (page 2).

This seems like a small change, but I believe an important one for usability.


texts: Is there a way to add CSS classes to Paragraphs Add More submit buttons?

texts:
I'm using the buttons method to add more paragraphs and am styling the buttons via css in a custom module. I'm setting paragraph icons as background images for each button so an editor can visually see what they will be adding with each button.

I can accomplish this via css by using:

input.button.field-add-more-submit[value="Add My Great Paragraph"]{
  background-image: //my icon
}

but am looking for a more bulletproof way to styles these buttons than the value. I'd like to add the paragraph bundle type machine name to the input as a class (in case the label of the paragraph type changes down the road).

I can access the paragraphs field widget by using a widget form alter but haven't been able to get to the buttons from there.

function my_custom_module_field_widget_form_alter(&$element, \Drupal\Core\Form\FormStateInterface $form_state, $context) {
  $field_definition = $context['items']->getFieldDefinition();
  if ($field_definition->getType() == 'entity_reference_revisions') {
    //can access the paragraphs field here but not the buttons
  }
}

Any ideas would be helpful, thanks.


texts: Fire a rule only when a specific webform has been submitted

texts:
I am using the latest version of both drupal 8 and webform 8

Here is my use case:

I have on my drupal 8 website 3 different webforms (webform A, Webform B and Webform C)

Now, I want to fire a rule ONLY when "Webform A" is submitted.

I understand that we should use condition to limit the rule to one webform only.

For example in drupal 8 if i want to show a message on the website when a new content of type article is saved, i do the below:

1) EVENT: After saving new content (rules_entity_insert:node)

2) CONDITION: Node is of type; Node is of type: node; Content Types: article

3) ACTION: Show a message on the site.

And it is working pretty good when saving a content of type ARTICLE.

Now, i want ot do the same but using a webform instead of a node.

Here what i did so far:

1) EVENT: After saving a new webform submission (rules_entity_insert:webform_submissiom)

2) ACTION: Show a message on the site.

After saving a new webform submission, the message is indeed showing on the website which is perfect.

However, the problem is that the message is showing for any SUBMITTED WEBFORM.

In order to limit the rules to be fired only when the webform A is sumbitted, a condition should be added to the rule in question.

I have used the below conditions

"Entity is of type"

"Node is of type"

"Webform"

"Webforms"

trying to limit the rule for only one webform and all above conditions resulted an error on the site after trying to submit any webform:

(The website encountered an unexpected error. Please try again later)

And when i remove the condition added, the site work properly again.

Any idea what is going on ?

Or maybe i am using the wrong condition to specify only one webform ?

Main question:

What is the condition to be used in order to fire a rule ONLY when one specific webform has been submitted.

Thank you in advance,


texts: I am working in drupal 6. I know that saving any node clears cache but is the same with views? I am experiencing this issue. I would like to know how to prevent it. Thank you.


texts: Restrict User Type to buy a Product Type in Drupal Commerce

texts:
I am selling membership type without using subscription module as it doesn't fit into my scenario. I am assiging role by help of rules as per Randy screencast & it works nice for me.

Now the problem is with renewal of the membership. So I have to set up another kind of product type, which will work for renewing the membership.

So is there any way to restrict usertype to buy any product type ?

Thanks :)


texts: How to add a width attribute to a responsive image with srcset?

texts:
When using a responsive image with srcset the width and height attributes are not available in twig. Both of them are NULL When an image is uploaded that is too small images are stretched or blown up as described in this post: Responsive Images, The sizes Attribute, and Unexpected Image Sizes

Being able to set a with equal to the pixelsize of the image would solve this issue. How can I make these attributes available for twig?


texts: Using PHP 5.2.17 in Acquia Dev Desktop 2

texts:
I'm using Acquia Dev Desktop 2 with Drupal 7. On PHP version selection menu, I only see "5.3.29", "5.4.33", "5.5.17".

Is it possible to switch PHP version to PHP 5.2.17 since most of my hosting provider based on PHP 5.2.17.

Or would you recommend anything other than Acquia Dev Desktop 2?

Thank you.


texts: How can I convert special characters to normal characters in an URL query string?

texts:
? and = will be used as parts in my url. In generating the url, I use

<?php echo l('node/'. $someID .'/delete?destination=chapter/'. $anotherID);?>. When I check on Firebug, the href attribute of the link is not the usual url, instead of having ?, it is being replaced with %3F and = is being replaced with %3D. How do I fix this?


texts: Autofill multiple fields with similar data

texts:
I would like to have field B auto filled while field A is being filled.

For example, for content type account, I have fields username, user email. While I enter example in username, user email is supposed to auto populate itself as example@gmail.com

Thanks


texts: hook_menu() doesn't work as expected. How can I fix that?

texts:
hook_menu() contains the following code.

//案件 >　インポート設定 > GMC_Subaccountの追加
$items[FEED_MANAGER_MENU_PATH.'/import/%import_id/gmc_subaccount/add'] = array(
    'title' => 'GMCサブアカウントの追加',
    'page callback' => 'drupal_get_form',
    'page arguments' => array('feed_manager_import_gmc_subaccount_edit', 2),
    'access arguments' => array('feed import gmc_subaccount edit'),
    'type' => MENU_LOCAL_ACTION,
    'file' => 'feed_manager.import_gmc_subaccount.inc',
);
//案件 >　インポート設定 > GMC_Subaccountの編集
$items[FEED_MANAGER_MENU_PATH.'/import/%import_id/gmc_subaccount/%store_id'] = array(
    'title' => 'GMCサブアカウントの編集',
    'page callback' => 'drupal_get_form',
    'page arguments' => array('feed_manager_import_gmc_subaccount_edit', 2, 4),
    'access arguments' => array('feed import gmc_subaccount edit'),
    'type' => MENU_CALLBACK,
    'file' => 'feed_manager.import_gmc_subaccount.inc',
);

When I visit /import/%import_id/gmc_subaccount/%store_id, it does't show the edit page, but the list page, which is defined from the following code.

//案件 >　インポート設定 > GMC_Subaccount_設定
$items[FEED_MANAGER_MENU_PATH.'/import/%import_id/gmc_subaccount'] = array(
    'title' => 'GMCサブアカウント',
    'page callback' => 'drupal_get_form',
    'page arguments' => array('feed_manager_import_gmc_subaccount_list', 2),
    'access arguments' => array('feed import gmc_subaccount edit'),
    'type' => MENU_CALLBACK,
    'file' => 'feed_manager.import_gmc_subaccount.inc',
);

The code I use to create the link to the edit page is the  following.

$row['data'][] = l(t('Edit'), FEED_MANAGER_MENU_PATH.'/import/'.$data->import_id.'/gmc_subaccount/'.$data->store_id.'/edit');

How can I fix the fact that link shows the wrong page?


texts: Drupal-7 Where can I change the text from Simplenews unsubscription confirm page?

texts:
I want to edit the message of the simplenews confirmation message when you unsubscribe from a newsletter.
It is the simplenews_confirm_removal_form but I can't track the code, to edit the message and the buttons' text.
Do you know where I can find it?


texts: How do you include a Dev module in a make file?

texts:
I am using Drush make files to automate my site development.

I have followed this tutorial to create a Make File via Drush.

Everything works fine, except when I run the make file, Drush says it can't find the Development versions of modules (for the modules where I have used the Dev version).

According to this tutorial, this is because you have to specify the Git Address and Revision ID of the module. How do you do that?

Steps I have taken

For example, lets say I want to include 7.x-1.x-dev release of the Fences module.
This dev module was released on 2013-Sep-30.

On the project page, there is an option called View all Releases. However, on this page, none of the releases are dated 2013-Sep-30. The project page also has links to a Git page for the project. However, this doesn't seem to have been updated for a while as the newest update was 15 months ago.

How do I find the Git address for this Dev module or is there another way of including it in my make file?


texts: D7: Nested field collections with entity translation issues

texts:
I have a nested field collection where the fields inside the field collection need to be translated. Structure:

field_collection header:
— Header (textfield)
— field_collection specs:
——— Name (textfield)
——— Value (textfield)

I have tried multiple configurations for the fields but I don’t seem to get it to work nicely with entity translation.

According to the readme one must enable the entity translation settings for the field collections, disable translations on the field collection fields, and enable the translation on the fields inside the field collection (in my case the textfields).

  Full readme part that is relevant:

  Field collection items must be
  selected as a translatable entity type at
  Admin -> Config -> Regional -> Entity Translation.
  The common use case is to leave the field collection field
  untranslatable
  and set the necessary fields inside it to translatable.  There is currently
  a known issue where a host can not be translated unless it has at least
  one other field that is translatable, even if some fields inside one of
  its field collections are translatable.
  The alternate use case is to make the field collection field in
  the host
  translatable.  If this is done it does not matter whether the inner fields
  are set to translatable or not, they will all be translatable as every
  language for the host will have a completely separate copy of the field
  collection item(s).

When saving an item the header field saves fine for all languages, but the second field collection doesn’t seem to play nice and only save the values multiple times in one language.

I have the feeling it's a configuration issue with the field collections/entity translation/field collection settings. But I can't seem to find the sweet spot where it works as expected.


texts:
Basically I'm looking for a module/tool/mechanism that I could use to post to a WordPress install from my Drupal install. Ideally this would be filtered per post type and on/off per post. My scenario. I've got a custom post type in my Drupal site which I post to frequently. Sometimes (depending on the post) I'd like to to post to WordPress also, without the hassle of having to login to another platform. Apparently there was this module: https://drupal.org/project/wp_publish

But it seems is not ported to D7. Any knows anything else?

Many thanks

PS: Its not a migration. Some posts will only go to D7, and some will be posted on D7 and WP.
PPS: Both sites have very different objectives and only share some content, so no need for a joint solution/migration/etc.


texts: Access Denied when logging in using Safari

texts:
When I login to example.com via Safari web browser, I get a message that says "Access Denied. You are not authorized to access this page."

I can login properly when using Chrome, Firefox, and Internet Explorer.

I can login properly using Safari in the local instance of the site.

$base_url is set as http://www.example.com and $cookie_domain is set as .example.com. I've also tried commenting out $cookie_comain.

I've already added

// Change base_url to HTTPS ($base_url may be explicitly set by settings.php)
if (isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] == 'on') {
  global $base_url;
  $base_url = str_replace('http://', 'https://', $base_url);
}

to the Secure Page module as suggested in https://drupal.org/node/863562#comment-3266304.

I've cleared the Drupal cache and Safari browser cache.

$conf['https'] is set to TRUE.

This happens on Safari 5.1.7, but not on Safari 3.2.2.

Compared the Http Headers with another Drupal site using Secure Pages. Didn't find anything fishy.


texts: How to change path of public files Drupal

texts:
Public files in Drupal have a relative path that is similar to /sites/default/files/file.txt; private files have a relative path similar to /sites/default/files/privates and system files have a relative path similar to /system/files/file.txt.

How can I make the relative path for public files be /public/files/file.txt?


texts:
The project I'm working on has a specific requirement where I need to export the main menu as an HTML file. I figured the simplest way to do it would be using views but I found that views doesn't interact with the menu system.

I looked up the menu_import module to see how it exports menus to JSON files to see if I could rewrite the output to be HTML but haven't really gotten too far with that.

Any ideas how I can approach this?


texts:
I've transferred a Drupal 7 website from online to my mac to work on some features. Styled images cannot be generated for some reason.

I've tried deleting styles folder, adding $conf['image_allow_insecure_derivatives'] = TRUE; in settings.php, disabling & enabling clean URLs, deactivating & activating my theme again (a ZEN sub theme), uncommenting # RewriteBase / in my .htaccess and all those tricks suggested by people online with no success. Public path is set to sites/default/files and temporary to sites/all/temp and no problems are reported on admin/reports/status.

I now believe the problem is caused by user permissions/ownership. I've changed permissions to 777 for sites/default/files and everything included in it. That didn't help. All these folders seem to belong to user "my_name" and group "admin". I would use the Apache web user/group but there is no user/group set in httpd.conf. Instead, these values are #-1 for both. I've changed those to "my_name" and "admin" but that didn't help either.

All styled images paths are generated but no styled images can be written.

The errors I get in apache error log:

Source image at public://my_images_folder/image_name.jpg not found while trying to generate derivative image at public://styles/imagestyle_name/public/my_images_folder/image_name.jpg.
File does not exist: /Applications/MAMP/htdocs/sites, referer: http://localhost:8888/mysitename/
File does not exist: /Applications/MAMP/htdocs/sites, referer: http://localhost:8888/mysitename/sites/default/files/css/css_IMsYmhC0oNVV9rVA6Vo68yqyWN_bxGEed8znhByDkfA.css
File does not exist: /Applications/MAMP/htdocs/mysitename/sites/default/files/styles/140x75, referer: http://localhost:8888/mysitename/
File does not exist: /Applications/MAMP/htdocs/mysitename/sites/default/files/styles/210x85/public/my_images_folder/image_name.PNG, referer: http://localhost:8888/mysitename/
and other similar ones for /Applications/MAMP/htdocs/modules, /Applications/MAMP/htdocs/themes, /Applications/MAMP/htdocs/misc etc.

I've also installed a new Drupal 7 site next to this site and it works fine, styled images are displayed well.

I've also tried different PHP versions (MAMP PRO allows to easily change versions) but that didn't help either.

I'd appreciate any suggestion to solve this problem.


texts:
I have been looking for a way to add a custom payment with custom fields in Ubercart, but have been unsuccessful in my search.

The only module remotely close to what I need was here: https://www.drupal.org/project/uc_custom_payment but it ended up being a flop with a variety of errors popping up after installation.

Has anyone added custom payments and been successful with them?

Thanks!
Matt


texts: How to issue 404 from a KernelEvents::REQUEST event

texts:
I'm trying to issue a 404 from a KernelEvents::REQUEST event, but it's resulting in the following error:

Fatal error: Maximum function nesting level of '256' reached, aborting! in /var/www/vendor/symfony/http-foundation/HeaderBag.php on line 162

Here's my class

<?php

namespace Drupal\my_module\EventSubscriber;

use Symfony\Component\EventDispatcher\EventSubscriberInterface;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpKernel\Event\GetResponseEvent;
use Symfony\Component\HttpKernel\Exception\NotFoundHttpException;
use Symfony\Component\HttpKernel\KernelEvents;

class MyClass implements EventSubscriberInterface {

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

    return $events;
  }

  public function my404Check(GetResponseEvent $event) {
    // Do some logic here to check if it should be a 404.
    throw new NotFoundHttpException();
  }

}

I'm guessing I can't throw exceptions here, but can't see any other documentation on how to issue the 404.


texts: Slow Search on Drupal 6.x site with 60.000+ nodes

texts:
We use Drupal 6 for http://www.boekwijs.nl. But when you search for something (which hasn't been searched for before, in other words; not in cache) it's very slow. At the moment there are 60.000 nodes with CCK fields and taxonomy terms.

What is the best way to optimize this? Are there any modules available? Do we need to use another search engine (SOLR?) or maybe another database structure?


texts: Using hooks to unset a header (view) in a view

texts:
Using Views 3.

I have a view (a table) with another view (showing a map) associated on its header. This header view is a Global:view

I want the user to choose if wants to see both views (table and map) or only the table. I could do some javascript stuff hiding the map view, but the question is to improve performance (by just javascripting Drupal would have to do the job of getting the data for both views, even if user only selects to see the table view)

With an export of the main view, I can see this part related to the view on the header ('faunas_map')

/* Header: Global: View (Views field view) */
$handler->display->display_options['header']['view_field']['id'] = 'view_field';
$handler->display->display_options['header']['view_field']['table'] = 'views';
$handler->display->display_options['header']['view_field']['field'] = 'view_field';
$handler->display->display_options['header']['view_field']['label'] = 'test';
$handler->display->display_options['header']['view_field']['element_label_colon'] = FALSE;
$handler->display->display_options['header']['view_field']['view'] = 'faunas_view';
$handler->display->display_options['header']['view_field']['display'] = 'faunas_map';
$handler->display->display_options['defaults']['footer'] = FALSE;

I have tried to unset the header with a pre_build hook with differents, methods, check below

function views_testing_views_pre_build(&$view) {

//using kpr I see that $view->display['faunas_map'] does not exist anymore there, but the map view is plotted in case
unset($view->display['faunas_map']);
kpr($view);
Fatal error: Call to a member function get_option() on a non-object in /var/www/html/bopa/sites/all/modules/modules/views/includes/view.inc on line 1137

//using kpr I see that $view->display_handler->handlers['header'] does not exist anymore there, but the map view is plotted in case
unset($view->display_handler->handlers['header']);
Fatal error: Call to a member function get_option() on a non-object in /var/www/html/bopa/sites/all/modules/modules/views/includes/view.inc on line 1137

the code related to the fatal error on view.inc (line 1137) is as follows.

          // Don't allow to use deactivated displays, but display them on the live preview.
           if (!$this->display[$this->current_display]->handler->get_option('enabled') && empty($this->live_preview)) {
              $this->build_info['fail'] = TRUE;
              return FALSE;
            }
Just for testing, uncommenting this code the  error log disappears but the map view is plotted :.(

Some more testings I did so far in views_testing_views_pre_build(&$view)

         unset($view->display['fauna_views']->display_options['header']);
         unset($view->display['fauna_views']->handler->options['header']);

I get error Notice: Undefined property: views_display::$handler in view->execute() (line 1137 of /var/www/html/my_site/sites/all/modules/modules/views/includes/view.inc).

    $header_item = $view->get_item('default', 'header', 'text');
    $view->set_item_option('default', 'header', 'text', 'content', 'MY TEXT' . $header_item['content']);

Errors:

Notice: Undefined index: id in views_plugin_display->get_handlers() (line 935 of /var/www/html/bopa/sites/all/modules/modules/views/plugins/views_plugin_display.inc).
Notice: Undefined index: table in views_plugin_display->get_handlers() (line 960 of /var/www/html/my_site/sites/all/modules/modules/views/plugins/views_plugin_display.inc).
Notice: Undefined index: field in views_plugin_display->get_handlers() (line 960 of /var/www/html/my_site/sites/all/modules/modules/views/plugins/views_plugin_display.inc).
Notice: Undefined index: table in views_handler->init() (line 226 of /var/www/html/my_site/sites/all/modules/modules/views/includes/handlers.inc).


texts: What's the difference between the "Mime Mail" and "Mail MIME" modules?

texts:
There appear to be two ways of sending HTML e-mail using Drupal:

Mail MIME with HTML Mail
Mime Mail

Mime Mail has significantly more installs, but it depends on Mailsystem, which is maintained by the maintainer of Mail MIME.

What is the difference between these modules?  Is one a fork of the other?


texts: Is it possible to display user's first login (activation) date in a view?

texts:
All the users are imported (only admin can create accounts), they receive an activation email to connect with a one-time login.
What I would like to know is how to display the date when they actually came at first (first login) and/or activate their account with the account process (password changing and save)?

Apart from the basic profile augmented with a few fields, my users have a native role that is dropped when they activate their account just to unlock automatically a function. So if there is a lead on "when the role was removed or changed" that I can't figure out right now, I might work with that.

I didn't put https://www.drupal.org/project/login_history yet unfortunately.


texts: How can I make all the links in the same View row "visited" when one of them is clicked?

texts:
I have a node View with Row style:Field and there are several fields with links to its node (the node of the row).

When users click one of those links only the actual link clicked gets "visited" and the color of the link changes.

But is there any way to make all those links(to the same node) "visited" when users click just one of them ?


texts: what is the purpose of views_get_view_result()

texts:
HI I am modifying drupal 6 site and I am totally new to drupal.I have the following code

foreach ($alerts as $a)
{
$filters = bevforce_filter_job_results($a['value']['alert_query_array']);
$results = views_get_view_result('jobs', 'block_4', $filters['title_nodes'], $filters['company'], $filters['city'], $filters['state'], $filters['zip'], $filters['types'], $filters['categories'], $filters['industries'], $filters['beverages'], $filters['user']);
}

In above code I am not finding any definition for the function views_get_view_result().I think this function is in built.Can any one tell me what views_get_view_result() does if its in built function.


texts: Fallback values for OG Meta Tags / hiding some unused OG fields

texts:
I'm using D7 and the Open Graph Meta Tag module to allow open graph meta tags to be set for various content types.

With the OG:summary field if not specified it falls back to the first 200 characters of the article body. Can anyone suggest how to change this fallback behaviour so that it instead uses a different field from the content_type as the fallback if not set?

Also is there a good way to hide some of the OG tags that are not going to be used? (location, type and contact sections specifically).


texts:
I have been tasked to flush out the content on a drupal site that utilizes the domain access module for multiple subdomains under one DB.

I have gone to structure->domains  and added all the domains but when I try to visit them I get server not found.
I have found that I need to direct the DNS to each url? I am still a little unsure of how this works. Is there a way to do this without accessing the host like through the .htaccess file or settings.php or httpconfig? I need to "configure all domains to the primary VirtualHost's ServerAlias, or else point all relevant DocumentRoots to my single installation of Drupal."

Can someone please help me get these last two subdomains pointed to the root install of drupal so the site actually shows up? Is this possible to do without editting the httpd.config file as I don't have access to the server files.

Thanks


texts: Count words of a body field using PHP views field

texts:
I'm looking for a way to count the amount of words in my body fields, using Views PHP. I am totally new to PHP and this looks so easy, but I must be missing something.

So I have a View for Content, containing a body field (hide display, HTML trimmed) and a Global: PHP field.

I have this in my "Value Code"-field inside the Global: PHP field settings:

$count = print $row->body;
$result = str_word_count("$count");

And this in my Output:

<?php echo $result ?>

Seems I must be missing something, but I get no error, nor any result. Just nothing happens.


texts: How could I change webform submission tags to common html email tags?

texts:
I have a webform submission style to display the submission ,like this

but when I send Html Email to others, it didn't show the way we want,it seems to didn't support fieldset and some css elements in some Email client. Now I am here for help that is there some ways or some modules to change the tags to common html email tags like  and add some css to it?
I'll appreciate anyone who help me solve this problem.


texts: Administrative form to create new entities of a custom entity type

texts:
I have created a custom entity type NOTE: it is based on an existing database structure and so ECK is not (according to Programming Drupal 7 Entities p. 84) able to deal with exposing an "existing database table[s] to Drupal".

I now need to create pages for users to create/edit/delete these entities themselves.

Surely there is something out there that allows me to just say "This is the entity type, this is the entity id, load all the columns in the database as $form fields and take care of it for me"?

EntityForm seems to me to want to make forms that are themselves entities.

entity_ui_get_form() seems to me to be about getting fieldable entities, but I'm trying to get the values as one can get by doing this...

$entity = entity_load('custom_entity', array($id));

...

$wrapper = entity_metadata_wrapper('custom_entity', $entity);

If this isn't something that can be done with only a few lines of code, what is the best approach? I got lost walking through the hook_menu() callbacks for node/add.

Thanks


texts: Caption Filter works in Preview, but not in regular view of node

texts:
I am using the caption filter module, which is working fine on a couple sites I manage, but on one specific site, when I use the markup and click on preview, it works perfectly, but if I save the node and then view it normally, it is clear that filter is not processing as it outputs the filter markup as plain text.

I am mystified as to why an input filter would work in preview, but not after its is saved.  I keep thinking it might be a permissions issue, but I can't identify anything that would seem to trigger this.

Any suggestions to narrowing down this issue would be greatly appreciated.  And I do have the caption filter as the last one, per the instructions and same with a similar site that I do not have this issue.


texts: want to display profile 2 fields in other than unique registration path also

texts:
i have used below code in a block to display the profile 2 fileds

<?php
print drupal_render(drupal_get_form('user_register_form'));
$profile = profile2_load_by_user($account);
print drupal_render(field_view_field('profile2', $profile['student'], 'field_class'));
?>

but the fields are displaying only on the site localhost/drupal/student/regsiter/, not in localhost/drupal/. I want the fields also to be displayed in localhost/drupal.Please help


texts: Focus problem when Ajax call for multiple fields calling the same callback function

texts:
I have implemented a custom form. I put same Ajax callback function for multiple field. When one Ajax call completes, I click on other field. But I can't unfocused previous field. Sometimes the Ajax call runs for multiple field.

My code:

$form['worklocation'] = array(
    '#title' => t('Work Location'),
    '#type' => 'textfield',

   '#autocomplete_route_name' => 'advance_search_autocomplete_callback.advancesearch_autocomplete_callback',
    '#autocomplete_route_parameters' => array('type' => 'worklocation'),
    '#ajax' => array(
      'callback' => [$this, 'friends_advance_search_results'],
    ),
    '#attributes' => array('class' => array('form-control')),

  );

  $form['school'] = array(
    '#title' => t('School'),
    '#type' => 'textfield',

    '#autocomplete_route_name' => 'advance_search_autocomplete_callback.advancesearch_autocomplete_callback',
    '#autocomplete_route_parameters' => array('type' => 'school'),
    '#ajax' => array(
      'callback' => [$this, 'friends_advance_search_results'],
    ),
    '#attributes' => array('class' => array('form-control')),

  );
  $form['college'] = array(
    '#title' => t('College / University'),
    '#type' => 'textfield',

   '#autocomplete_route_name' => 'advance_search_autocomplete_callback.advancesearch_autocomplete_callback',
    '#autocomplete_route_parameters' => array('type' => 'college'),
    '#ajax' => array(
      'callback' => [$this, 'friends_advance_search_results'],
    ),
    '#attributes' => array('class' => array('form-control')),

  );

Callbakck:

function friends_advance_search_results(array &$form, FormStateInterface $form_state) {

 $search_result = array(
                    '#theme' => 'friends_advanced_search_list',
                    '#friends' => $friends_list,
                    '#info' => array('display' => 'hide', 'friend_recommend' => 0, 'load_more' => $load_more, 'no_results' => 1,'search_action' => 1),

                    );

   $output = render($search_result);
   $id = '#advanced-friend-list';
   $response = new AjaxResponse();
   $response->addCommand(new ReplaceCommand($id, $output));

   return $response;

}

Problem:


texts: Can quiz creater assign quiz only to specific user

texts: In the Drupal 7 Quiz module, can the quiz-creator assign a quiz only to specific user, say user #1?


texts: How to change a filter handler of the view?

texts:
I have created a nice Filter Handler for my View, and I set it up using hook_views_data_alter.

Does this mean that this will ALWAYS be the Filter Handler for this particular field? What if I want a different Filter Handler later, in a different view?

How can I specifically say "Only use the X handler on page X?"

For posterity, I thought I'd outline more of what I was trying to accomplish here:

I have "Friends" page and a "Content" page. On the "Content" page, I wanted to be able to filter by "Content posted by my friends." However, on the "Friends" page I want to filter by "Users in my Groups." Both of these query on the user.uid field, so it was making the filters the same, even though I wanted totally different logic for the two views.


texts: Using Rules to Update the Data of a Relations Endpoints (Referenced Entities)

texts:
I have a Rule which triggers on a Relation update. It then checks for the Entity type of the first endpoint of the Relation. Then checks for a specific field. When I try to set an action to change this specific field, I get these errors related to the Revision ID which I can't seem to figure out.

Notice: Undefined property: stdClass::$revision_id in drupal_write_record() (line 7030 of ...\www\includes\common.inc).

Notice: Undefined property: RedhenContact::$revision_id in EntityAPIController->saveRevision() (line 525 of ...\www\sites\all\modules\entity\includes\entity.controller.inc).

Notice: Undefined index: revision_id in EntityAPIController->saveRevision() (line 528 of ...\www\sites\all\modules\entity\includes\entity.controller.inc).

Notice: Undefined index: revision_id in EntityAPIController->saveRevision() (line 533 of ...\www\sites\all\modules\entity\includes\entity.controller.inc).

DatabaseTransactionNoActiveException: in DatabaseConnection->rollback() (line 1024 of ...\www\includes\database\database.inc).

Simply put, I need a specific field on an Entity to update when a related Relation is updated. This seems simple, but for some reason I cant get it worked out...


texts:
I am theming a specific node type in Drupal 7. I have named my file node--mynodetypename.tpl.php. Everything is fine and I can override the default node template; the issue is that I want to do very slight changes to the regular node template, basically the way the DIVs are structured. I get into trouble trying to replicate the original layout.
I have installed the Content Templates module, and I am getting the variable names from there. I am not using it because it has some bugs in the current version.

How can I add the comments block to the end of my content type? I just want the ordinary comments engine placed in there, but it disappeared with my new layout. Contemplate does not provide the variable to make all that comments block appear.
Is there a correct way to publish the URL of an image? Contemplate provides me with this $node->field_image['pt-br'][0]['filename'] for the raw image file, but then I have to manually fulfill all the folder structure; it also gives me this $node->field_image['pt-br'][0]['uri']. It presents the folder structure above the image file, more or less like public://images/folder1/folder2/filename.JPG.
Is there some kind of function I should call that would build the entire image URL for me?
I have created a piped list of countries as a select list. In my layout, I would like to show the name of the country, but the variable generated in contemplate $node->field_country['pt-br'][0]['value'] only holds the country code; I would like to get the name of the country.
How can I do that?


texts: Detecting one account being accessed from multiple computers at the same time

texts:
I need to detect member access to the same account from different computers or web browsers at the same time with same email and password?

Are there any options or modules to get this information?


texts:
I've been trying to improve the speed of my Commerce site with various caching and performance modules. But the general ones recommended don't work or break my site. I can't see anything else out there that answers my question!

Boost - I thought this would work on static pages such as About or Contact, but the module doesn't cache anything at all.

Agrcache - breaks the JavaScript slideshow on the front page.

Core Library - breaks the login page (which is odd!)

I have views cache installed and that's the only one I've got working so far...


texts: list links to nodes in another node with Views

texts:
I'm currently struggling with the following scenario:

There are two different Content Types:

Offer
Event

What I want to achieve is this:

There are 6 offers and each of those offers have several events that are nodes as well, in those event nodes there's a field for the date when the event takes place.
For example: one of the offers is a photography workshop and I want a section in this node where the dates of the events (as a link to the event node) are listed.

I was thinking about creating a taxonomy with all the offers, whenever a event is created you have to select one of the tags.
In a second step I thought Views would be a good way to create this list of all the event dates to a specific offer by showing Content of type Event but I don't know where to go from there because I can't specifiy that it should only show the events with a specific tag.

EDIT

Alright I think I'm a bit closer to the solution, but I'd still need some assistance from you guys.

What I did:
Besides Views, I installed EVA.
Created a View that is neither a Page nor a Block with the following settings:

Fields
– Filter Criteria
–– Content: Type (=Event)

Added an Entity Content with the following settings:

Entity content settings
– Entity type: Node
– Bundles: Offer

Not sure where to go from there though. Can I add some kind of Contextual Filters or Relationships between the Offer and the Events?


texts:
I've got the following card in my drupal installation, I've hidden unnecessary items for my question in the picture.

What I want to achieve is the following:
I want the icon to change based on the taxonomy term showed besides the little icon (in this case, test).

This is the code that generates the card:

{% if topic_type %}
  {% embed "node--teaser__field.html.twig" %}
    {%- block field_icon -%} group {%- endblock -%}
    {%- block field_value -%} {{ topic_type }} {%- endblock -%}
  {% endembed %}
{% endif %}

I think it should look something like this but it gives me an error:

{% if topic_type %}
  {% embed "node--teaser__field.html.twig" %}
    {% if topic_type == 'test' %}
      {%- block field_icon -%} icon 1 {%- endblock -%}
    {% else %}
      {%- block field_icon -%} icon 2 {%- endblock -%}
    {% endif%}
    {%- block field_value -%} {{ topic_type }} {%- endblock -%}
  {% endembed %}
{% endif %}


texts: How to show/hide the prefix/suffix of fields in node templates?

texts: I previously asked a question about hiding the prefix/suffix in fields template here, now I want to understand how can I programmatically hide the prefix or suffix of numeric fields in nodes templates only?


texts: How to find out what modules are adding links to a menu?

texts: I was wondering if there's any way to find out what modules are adding links to what menus using hook_menu()? I don't care if it's a module or custom code added to Drupal core, I just need to know. There's a link showing up in my main menu and I have no idea what's putting it there. I'd really rather not go through every single module and check their menu hooks.


texts: How to get custom product line item text field value?

texts:
by using commerce customisable products module, I created a custom product line item type to which I added a text field (Machine name field_license_details). By following this excellent video tutorial
http://commerceguys.com/blog/commerce-module-tuesday-commerce-customizable-products-screencast

I was able to create a node/page which include the text field I mentioned before. However, what I find impossible to do, is to get the value that the user entered to that field. For example, when the user has entered something in the text field and clicks the add to cart button, I want the text he typed , to be 'placed' to a variable so i can do whatever i like with it for example display it back to the user or write it down to a file etc.
I understand that in order to achieve that I would need to write my own module , but I am not sure which hook I should implement, and how exactly  extract the string to a variable.
As you probably already understood by the nature of the question ,I am just getting started on drupal, so any suggestions would be more than welcome.
Thanks in advance
PS I am using drupal 7.22 (the latest stable version and I have installed the drupal commerce module, the commerce file and commerce customisable products modules.


texts: Displaying only what's entered on the page

texts: I have created a new field within one of the content types that can be entered on the content pages and placed the block into the layout, but it seems to add all the pages content that was entered in on all the pages within that field. How can I filter it, so it only shows what has been entered on that specific page.


texts: Define states that target only element in multi-value fieldset

texts:
I am using Webforms in Drupal 8, and I have a checkbox on a webform composite element which basically show/hides an address field.

public static function getCompositeElements() {
  $elements = [];

  $elements['address_same'] = [
    '#type' => 'checkbox',
    '#title' => t('They live at the same address'),
  ];

  $elements['address_postal'] = [
    '#type' => 'textfield',
    '#title' => t('Street address'),
    '#states' => [
      'visible' => [
        ':input[name="spouse[address_same]"]' => array('checked' => FALSE),
      ]
    ]
  ];
}

The issue I have is that this group of fields may have one or more values on the form, and if there is more than one then the states get all confused because they are targeting the wrong field.

This may be the same on Drupal 7, but I can not figure out how to give #states a generic selector for address_same so that it only targets the one just before it.

Most likely I will just go write some custom jQuery for this, just thought there must be a way of doing it.


texts: No commerce_price field in product after Kickstart

texts:
I installed Commerce Kickstart 7.x-2.35 and I'm doing a Ubercart Commerce migration (from my current Drupal 6 site) using the Commerce Migrate Ubercart module. When migrating first products I don't see the prices and get an error message:

  Notice: Undefined property: stdClass::$commerce_price en
  commerce_product_line_item_populate() in line 1394 of the
  commerce_product_reference.module.

During migration the old Ubercart price (sell_price) is correctly mapped to commerce_price.

When checking Product Display type I don't see any price field, the only fields I see are product title, url, body, category and reference. Should I manually add a price field commerce_price? How to do that?


texts: applyUpdates() is deprecated. Is it really needed in hook_install() anyway?

texts:
I maintain a contrib module which defines two base fields, but these are not added to any content type on installation, as this is done during admin config. The module has

// Add our base fields to the schema.
  \Drupal::service('entity.definition_update_manager')->applyUpdates();

in it's hook_install() and hook_uninstall().
Now that this function is deprecated in core 8.7 I've tried removing the lines and installing, and it seems to work OK.

So can it be OK to simply remove the calls to applyUpdates() ?
I think there were problems with fields not being deleted in the early days of Drupal 8, but maybe it all works better now.

For info, the change record is https://www.drupal.org/node/3034742

Edit: Config inspector is only partially helpful. The fields show up only after saving the content type form display. After uninstall the fields are still shown, but I think this was the case anyway (there is a Core issue relating to this)


texts: How do I get a path alias using the REST API?

texts:
I use Drupal 8. I generated path aliases for user entities using the Pathauto module, so /user/1 is accessible through /yourusername.

How can I access the path alias using a GET command (e.g. REST API)?


texts: How can I call Rest API data from one module to autopopulate on another module?

texts:
I have created one module in Drupal 7, in which I have created a form and on submit I have called an Ajax submit callback function which returns a response of a Rest API. Now I want those data from this module to autopopulate or print on the user form (which comes from an existing user module). Anybody is there to look into this to help?
This is some part of my code:
function authentication_form_callback($form, &$fstate) {
  $userName = $_POST["user_name"];
  $curl = curl_init();
  curl_setopt_array($curl, [CURLOPT_URL => "urltocallrestapi", CURLOPT_CUSTOMREQUEST => "POST", CURLOPT_SSL_VERIFYPEER => FALSE, CURLOPT_SSL_VERIFYHOST => FALSE, CURLOPT_POSTFIELDS => "{\"PF_NUMBER\":\"$userName\",\"SOURCE_ID\":\"abc\",\"REQUEST_REFERENCE_NUMBER\":\"1234567\"}", CURLOPT_HTTPHEADER => ["Content-Type: application/json",],]);
  $response = curl_exec($curl);
  $data = json_decode($response);
  echo $response;
  curl_close($curl);
}

I have called rest API data successfully.


texts: How do I load the current items in cart of the anonymous user?

texts:
I am working on a custom module for our payment system using Drupal 8 and Commerce 2. When a user removes and item for the cart or updates the quantity, I need to sync the two systems (our internal and Drupal commerce's cart). Our site has one store and all products are associated with that store.
I need to be able to load (and loop) over all the items still in the cart after the CartOrderItemRemoveEvent and the CartOrderItemUpdateEvent events. I tried using the following code, but the order is an empty array, despite the cart still having other items in it.
$user = \Drupal\user\Entity\User::load(\Drupal::currentUser()->id()); //Which is 0 for anonymous
$order = \Drupal::entityTypeManager()->getStorage('commerce_order')->loadByProperties(['uid' => $user->get('uid')->value, 'cart' => '0']);

Is there a way to get the anonymous user's cart and a list of items still in that cart?
//updated
 public function cartItemRemoved(CartOrderItemRemoveEvent $event) {
      $cart_provider = \Drupal::service('commerce_cart.cart_provider');
      $cart = $cart_provider->getCart('default');
      $order_items = $cart->order_items->referencedEntities();
    \Drupal::logger('current cart items')->info('
' . print_r(json_encode($order_items), TRUE) . '
');

}


texts: How do I enable the browser spell checker in WYSIWYG editor?

texts:
I want to use the in-browser spell checker within the Drupal 7 WYSIWYG editor, which is currently disabled by default.

I found this post but the settings aren't availble in my Drupal module. When I go to Home » Administration » Configuration » Content authoring there doesn't seem to be a place to enable or turn off the disabled browser spell checker. Thanks for any help!


texts: I'm trying to debug an error I'm encountering in the latest version of the Custom Formatters module and I'm encountering a common problem I have in debugging.  There's no easy way to do a project-wide diff of project from release to release.  I'd like to easily diff https://www.drupal.org/project/custom_formatters 7.x-2.4 with 7.x-2.3.  I can use software locally to do that, but github has spoiled me I guess.  Am I missing a hidden function of drupal.org that shows diffs between releases?


texts: Drupal site that points to a non-drupal .html page

texts: I'd like to configure my Drupal 6's site's front page to be "foo/index.htm", a hand-coded html file. But when I put that relative URL into Home › Administer › Site configuration › Default Front Page, it complains "The path 'foo/index.htm' is either invalid or you do not have access to it." It's a unix filesystem and everything is world-read, and the directories are world-execute. What could be the problem here?


texts: hook_node_access($node, $op, $account) not working

texts:
I'm using drupal 7.41 module: Devel

I created module_template module.

function module_template_node_access($node, $op, $account) {
kpr($op);
    kpr($account);
}

But when I view or edit node not display krumo ??? Can someone help me in this matter?


texts:
I have a problem while sending a HTML email through my module, Here is my code below:

.install file

function invite_an_user_enable() {
  $current = variable_get('mail_system', array('default-system' => 'DefaultMailSystem'));
  $addition = array('invite_an_user' => 'invite_an_userMailSystem');
  variable_set('mail_system', array_merge($current, $addition));
}

function invite_an_user_disable() {
  $mail_system = variable_get('mail_system', array('default-system' => 'DefaultMailSystem'));
  unset($mail_system['invite_an_user']);
  variable_set('mail_system', $mail_system);
}

and here is the .module file:

class invite_an_userMailSystem extends DefaultMailSystem {
  public function format(array $message) {
    $message['body'] = implode("\n\n", $message['body']);
    $message['body'] = drupal_wrap_mail($message['body']);
    return $message;
  }
}

Here is the email that I got:

Hi myemail@email.com,&nbsp;

Your friend another_email@email.com, invited you in My Site Name. Please cleck on the link to accept the invitation below:

http://something.com/referral/3139323e

&nbsp;

Thanks,

My Site

Now the problem is that, when I received the email I can see all the tags in my email. And the header of the email is

MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed; delsp=yes
Content-Transfer-Encoding: 8Bit
X-Mailer: Drupal

I believe this should be text/html rather than text/plain.
Am I doing something wrong? Is there any different method to send HTML mail? Feel free to ask any questions.


texts:
I have a view (using the table display format) that is showing all the node of a content type (A), and that content type has a reference to nodes of another content type (B). I added a VBO field to that view.

How can I create a content type B node for each node of the selected node (content type A) by setting the values just one time in the content type B create form?
(I need to create B nodes with the same field values for each node of A.)


texts: Do these options affect other modules and possibly core?

texts:
I have a question about downloading an unstable version of a module using composer. I run composer require 'drupal/page_manager:^4.0' but I get this error message.

  The requested package drupal/page_manager ~4.0 is satisfiable by drupal/page_manager[4.x-dev, 4.0.0-beta3, 4.0.0-beta2, 4.0.0-beta1] but these conflict with your requirements or minimum-stability.

I looked at the repository, and they don't seem to have a stable version. So I read that in my composer.json file I should put the following lines.

"prefer-stable" : true,
"minimum-stability": dev,

If I set these options to composer, will this affect other modules and possibly Drupal core? when I update core, could it download a development snapshot higher than the current version? If so, how do I downloading the development snapshot only for a module without affecting other modules/core?


texts:
Just installed 7.x-1.0-beta1 to Drupal 7rc1.

Should I see some new option in the configuration? Where should I set the connection settings? I have no idea how to use this module...


texts: How do I show a list of nodes referenced by a field?

texts:
I created two content types: News Agency and News.
The News content type has the Headline, Title, Body, and News agency name (a reference to a News Agency node) fields. The News agency content type has the News agency name and Publisher fields.

I need to show the news related to particular news agency. I am trying to set a relationship, but it still doesn't show result.


texts: Is there a way to import a currency type when doing a Feeds import?  I have tried using the Feeds Tamper add on and am currently looking at this solution.  It seems that I am trying to reinvent the wheel :)  I have created a cck field that was called "price" as a text field and it worked beautifully.  I created this as a currency field and the new "price" currency field doesn't show up as an option to map to on the mapper UI.  I exported the Feed Import and added the field manually and then imported it back in.  When I run the import it doesn't bring over the value that is mapped.


texts: Programmatically edit an image form field on a user account

texts:
I have added an image field to user accounts using the "Manage Fields" user interface.

I am trying to make a form that users can use to change their picture.

Below is some code I have tried. In it, I explicitly set the URI of the image when I update the user account. However, for some reason, the URI of the account changes itself to "temporary://image_file_name". No image appears on the account page.

function profile_pic_edit_form($form, &$form_state) {
  $form['picture_upload'] = array(
    '#type' => 'file',
    '#title' => t('Upload picture'),
    '#size' => 48,
  );

  $form['submit'] = array(
    '#type' => 'submit',
    '#value' =>t('Change my picture'),
  );

  return $form;
}

function profile_pic_edit_form_submit($form, &$form_state) {
      $validators = array(
            'file_validate_is_image' => array(),
      );
      if ($file = file_save_upload('picture_upload', $validators)) {

      $file->status   = FILE_STATUS_PERMANENT;
      file_save_upload('picture_upload', $validators);

      $info = image_get_info($file->uri);
      $destination = 'public://pictures/profile_pics/'.$file->filename;
      if (file_copy($file, $destination, FILE_EXISTS_REPLACE)) {

        $pic_array = array(
             'fid' => $file->fid,
             'alt' => '',
             'title' => '',
             'width' => $info['width'],
             'height' => $info['height'],
             'uid' => $file->uid,
             'filename' => $file->filename,
             'uri' => $destination,
             'filemime' => $file->filemime,
             'filesize' => $file->filesize,
             'status' => '1',
             'timestamp' => $file->timestamp,
           );
      }
      else {
        form_set_error('picture_upload', t("Failed to upload the picture image."));
      }
      }
    $account = user_load(arg(1));

    $edit = array(
     'field_profile_picture' => array(
       'und' => array(
         '0' => $form_state['values']['picture'],
          ),
        ),
     );
     user_save($account, $edit);
     //$account->field_profile_picture['und'][0]['uri']  is now  temporary://image_name.jpg
}


texts: How do you query exact match records with Views Filters, Entity References, and Taxonomies?

texts:
** Updated to keep the example consistent with the first paragraph. Using Taxonomy Terms, not the Taxonomies (term categories) themselves... based on Triskelion's comment **

How do you configure a Views Filter to return all users who have created at least one node with taxonomy term A “and” at least one node with taxonomy term B, where the taxonomy terms could be assigned to a single node or separate nodes?

Example:

Users
User1
User2
User3
User4

Taxonomy Terms
Taxonomy Term A
Taxonomy Term B
Taxonomy Term C
Taxonomy Term D

Nodes
NodeV -> created by User1 -> with Taxonomy Term A
NodeW -> created by User2 -> with Taxonomy Term A
NodeX -> created by User3 -> with Taxonomy Term C and Taxonomy Term D
NodeY -> created by User1 -> with Taxonomy Term B
NodeZ -> created by User2 -> with Taxonomy Term D

Views Filter Results
Show all users who have created a node with Taxonomy Term A
    Result: User1, User2
Show all users who have created a node with Taxonomy Term D
    Result: User2, User3
Show all users who have created a node with Taxonomy Term A and a node with Taxonomy Term D
    Result: User2

I currently have a view setup starting with Users and referencing the Nodes. I am having trouble making this work. Do I need to reverse the order and set the view for Nodes referencing the Users? Or am I barking up the wrong tree and should just jump to using Hooks?


texts: Saving file upload destination as private

texts: I have a content type with a file field where I want the files to be private... I set the upload destination to private, but when the field instance is saved with features, this setting is not saved. How can I save this for use with an installation profile? (all other content types use public files)


texts: How do I load an external class into the Controller?

texts:
I'm playing with module building in Drupal 8, but can't really figure out how to include a custom class which does not extend any other. The class' only purpose is to reduce the amount of code I have in a controller.

However, I get the error:

  Fatal error: Class 'Drupal\first\FirstClass' not found in /var/www/drupal/modules/first/src/Controller/DefaultController.php on line 30

How do I let DefaultController.php know where to find FirstClass.php? Should I just do an include_once()?

Routing file:

first.default_controller_hello:
  path: 'first/hello/{name}'
  defaults:
    _content: '\Drupal\first\Controller\DefaultController::hello'
    _title: 'first Title'
  requirements:
    _permission: 'access content'

Controller function:

namespace Drupal\first\Controller;

use Drupal\Core\Controller\ControllerBase;
use Drupal\first\FirstClass;

class DefaultController extends ControllerBase {

  /**
   * hello
   * @return string
   */
  public function hello($name)
  {
    $a = new \Drupal\first\FirstClass();
    dsm($a);
    return "Hello ".$name." !" . $a->getV();
  }
}

Outside Class:

<?php
namespace Drupal\first;

class FirstClass {

    public static function getV() {
        return 'well it works?';
    }
}


texts:
I'm in charge of a website that have an huge amount of queries all the time, so we activated drupal cache (in performance). It was great, for all guests the page was very fast to load (not so fast for logged in users).

Right now, I'm migrating the server to a new one, I managed to update everything, and I use HHVM, and it's really great, the page load very fast actually. But I noticed on the new server, that the page for guests and logged in users takes the same time to load, and on the old server, I have a "cache" directory in the main folder, not on the new server.
(to migrate, I installed a new drupal, and I moved the module directory, the themes one, and the db).

And I made a test with siege, on the old server, it would return 301 sometimes, while it always return 200 on the new server.

So basically, everything works fine, really fast compare to the old server, except I think the drupal cache doesn't work :(


texts: Remove labels in printer friendly version of books

texts: Is there any way to remove labels or apply a CSS file to the printer-friendly version of books?


texts: How to check whether a username is in use?

texts:
I'm currently trying to implement a function to check if a user already exists. I've read that this could be done by Rules whit the condition "Entity exists by property" but I can't find it anywhere. I've tried it with Rules 7.x-2.2 & Rules 7.x-2.3

Is this option still available or not? Or is it located in a other module?

it's related to this question: How can I check whether a username is in use?


texts:
on a drupal 6 website i encounter encoding issues for anonymous user.
on 2 differents pages like : http://www.lycee-brise-lames.fr/lycee/outils

I enable the JS compression but this not seem to fix the issue.
i don't use module to manage cache on this website, this is the only one that do this among 7.

have you some ideas to check ?

thanks


texts: Drupal Views: How to remove 1 item if it matches the Node TItle

texts:
I'm trying to remove one item from a block view if the CCK node title of that item matches the node title of the page it is appearing on.  Can someone tell me how I would achieve this?
Thank you!


texts: Mystery "test" text showing on page after views module update

texts:
I've got an instance of mystery text showing on my blog.

Here's the scenario:
I've just run the security update to 7.x-3.8 on a drupal site running 7.28 on my local machine, and didn't see this issue. When I ran the updates on the live site the issue appeared.

On the homepage blog, at the bottom of every post there is the word "test". I know it's outside of the body field tag, but I have no idea where it's coming from.
Seen here: http://susanhoodbooks.com/

I've checked the code of the view, the templates, the contents of the nodes and I can't find anything.
I'm hoping to ask for some suggestions of where I might look next before I revert the modules.
again, I haven't been able to recreate this on my local.

Please let me know if I need to supply any other information.
Thanks


texts: unable to get custom service to return result using services module

texts:
I'm learning about web services and implementing it in drupal 6 and am trying to use Services module with its REST server for implementing a web service to add a user.

Since there is an existing functionality for all CRUD operation for users, I am trying to implement my custom code to register a user by using a HTTP POST of the respective data using REST as a part of the challenge. I implemented custom user resource in my module (awesomeness.module) and got it to show up in the list of resources with the respective operation (Create).

/**
 * Implements hook_services_resources().
 */
function awesomeness_services_resources() {
  return array(
    'awesome_registrant' => array(
      'operations' => array(
        'create' => array(
          'file' => array('type' => 'inc', 'module' => 'awesomeness'),
          'callback' => '_create_registrant_from_awesomeness',
          'help' => 'Creates or updates user from the
                     json data initiated by the Awesomeness request.',
          'access callback' => '_create_registrant_from_awesomeness_permissions',
          'access arguments' => array('dummy'),
          'access callback file' => array('type' => 'inc', 'module' => 'awesomeness'),
          'args' => array(
            array(
              'name' => 'user_data',
              'type' => 'string',
              'description' => 'The json data of User posted
                                by Awesomeness to register information.',
              'optional' => FALSE,
              'source' => 'data',
            ),
          ),
        ),
      ),
    ),
  );
}

The corresponding callbacks for the request and access in awesomeness.inc are as below

/**
 * Callback function to create or registrant from the web service request
 */
function _create_registrant_from_awesomeness($user_data) {
  watchdog('AwesomeWebservice', "I am called");
  $user_info = var_export($user_data, TRUE);
  watchdog('AwesomeWebservice', $user_info);
  return "Is called";
}

/**
 * Access callback for the registration Web service.
 */
function _create_registrant_from_awesomeness_permissions($access = TRUE) {
  // any logic on access restriction goes here, currently
  // setting true to check that calls can be made as an anonymous user
  return TRUE;
}

I created an endpoint and enabled Create for awesome_registrant and made the POST request with POSTER add-on for firefox set the Content type as application/x-www-form-urlencoded
and the following json data in content body
{"username":"awesomeuser@kungfupandafan.com","password":"epicawesomeness"}.

However I merely get a response code of 200 and nothing more where I expect the callback to return "Is called".

Enabling the debug mode shows only the Server info object but not the controller or the data about the return value unlike the core services like node retrieve.

Also for sake of clarification application/x-www-form-urlencoded is enabled for the REST web server. Any help on what I might have missed or where I have erred would be greatly appreciated.


texts:
I have a content type with a Long text and summary field. In the node view display, it is set to to show as Summary or trimmed.

I have a module that gets all the nodes of that content type.

How do I programmatically get the trimmed value of that field? Using var_dump(), I get the following output.

  ["field_description"]=>
  array(1) {
    ["und"]=>
    array(1) {
      [0]=>
      array(5) {
        ["value"]=>
        string(5763) "
Test user DescriptionTest
"
        ["summary"]=>
        string(0) ""
        ["format"]=>
        string(9) "full_html"
        ["safe_value"]=>
        string(5764) "
Test user Description
"
        ["safe_summary"]=>
        string(0) ""
      }
    }


texts: How to get link path in custom block for a view?

texts:
I created a view (unformatted) associated with a content type with two simple fields for a block.
The view is called "phrases" have generated two .tpl:

a) views-view-unformatted--phrases-block.tpl.php (to style row).

b) views-view-fields--phrases-block.tpl.php (to style the fields).

How to generate the link to the content, because by the variables I do not receive the direction I need.

I have available only the variable "$content", but this is formatted with something like:

     Path

I need to assign a class to the "a tag" , but as I receive all formatting can not.

Example i need:

    Path

As I can generate the correct path to the content?


texts: Only admin can see products page for Drupal Commerce

texts:
I created a subscription product with Drupal Commerce and commerce_sp modules.  I then created a view to display the product subscription I want and as Administrator I can see the product on the product page just fine, but as an authenticated user the page is available to view via a link in a menu, but the page doesn't show the list of products, just white space.  I've gone into the permissions to make sure the user can purchase an item and go through the check out forms, and the view has no access control on it.

I'm pulling my hair out over this, I have no idea why no one but the admin can see the products listed on the page.