texts: Custom Content types nodes with Nodeblocks module

texts:
I have been unsuccessful in accomplishing the following:

I am using the Nodeblocks module and trying to follow its documentation for using it with a custom content type.  My custom content type machine name is content_block. I want a client to be able to create a new content_block and then be able to place it wherever he wants using the Admin > Blocks page.

The content_block content type has these fields (machine names - purpose):

title - Title of the block (nodeblock) that will be seen on the Blocks administration page. Will be hidden from output.
field_headline_level - stores a value like, "h2", "h3", "h4", etc. To be used to customize the HTML Headline tag. Will be hidden from output.
field_headline - The actual words for the headline
field_content - Content to be displayed below the headline

I've been trying to follow the Nodeblocks documentation (linked above) as well as the Drupal 7 Template Suggestions but I can not get it to work.  I keep running into nested template problems, such as the default block template wrapping around the node type template and getting double headlines.  I also can't figure out the correct syntax to display the various content_block fields.

Can anyone out there help me out or point me to a "Node Templates for Dummies" article?  I've done lots of searches on Google, but can't find anything very helpful.


texts:
I have two content types in my application:-
Student
Teacher

Teacher-Student has parent child relationship.
Inside Student there is a node reference field to Teacher which means that when creating a student user needs to provide one or more Teacher's before saving content type.
So one student is related to multiple Teacher here.

Suppose X is a student. Y and Z are teachers of X. Now when I opened the student(X) page then I want to see all the related students in a block who belongs to either (Y or Z) or Both.

Can it be possible using Views UI?Please let me know your suggestion on this.


texts:
I have taxonomy list of color names(red, black, etc). If I create an exposed filter form, how can I show the color with corresponding coloring? I want to style each select option with background color, i.e for the option Red, the background should be red. Can we style that in the stylesheet?

I use view3 and views_hacks
thanks.


texts: SQL injection Drupal Core - Highly Critical - Public Service announcement - PSA-2014-003 issue

texts:
I got this news today about  SA-CORE-2014-005 - Drupal core - SQL injection.

We are not using drupal in build authentication. We have a custom authentication, which resides behind SSO and gateway. A user can only get access or even get access page if the user is the in SSO and Gateway servers.

Is this kind of setting also vulnerable to this attack, as access is not handled by drupal?


texts: View of taxonomy terms - add preprocess class

texts:
I have a view showing taxonomy terms with an images field. I'd like to add a class .has-images if the images field is not empty.

I've done this before with nodes using preprocess, have tried something similar and have looked around for an answer though I can't seem to get it to work. Also where would the code go? would it go in a view.preprocess.inc file?

This is an example of node.preprocess.inc

function THEMENAME_preprocess_node(&$vars) {
 if(!empty($vars['field_images'])) {
    $vars['classes_array'][] = 'has-images';
 }
}

Any help would be much appreciated.


texts: How to access a variable in the ready event within charts_google.js without hacking the chart module?

texts:
I need to be able to respond to the ready event within the Chart module.

I have Homebox installed and one of the blocks used in it is a google chart. The homebox resize action takes place before the chart has finished rendering and is misalligned.

I need to call the homebox resize action from the chart ready event. Currently I have added this code to the charts_google.js file, which works fine but I need to move it out of the chart module into my custom module.

function myReadyHandler(){ // added this
  Drupal.homebox.equalizeColumnsHeights();
}

function renderCharts() {
 ...
 google.visualization.events.addListener(wrap, 'ready', myReadyHandler); // added this
 ...
}

The variables in question is wrap. How can I get access to this variable in my own module without hacking charts_google.js?


texts:
Forgive the obtuse explanation.

I have a content type, called SHOW. this show type has a title and client and supervisor and a number of other fields associated with it.

I have an employee of the company fill out the SHOW information on the website. then, this information is available to all employees - it's an intranet.

I have another content type. It's called REQUEST. The first field in this form is a relate-able auto complete list of the SHOW titles that have been created on our site. This content type has some other fields as well, none that are related to anything else.

I have a panel that displays pertinent information from a show, the stuff I want like title and some of the other fields. All is good. In panels I've overridden the node panel for this content type to do this.

Now here's my problem.

I created a view as a table to show the REQUEST content types. I want to show this view in the SHOW panel. I've managed to do this. BUT, i only want to show the view for the corresponding SHOW that I'm in the panel for. I have 3 shows (these are TV shot titles) and each show has like 6 REQUEST content types filled out for it. Again, I only want to show this view on this panel for this specific show.

I'm so lost. Can anyone help?


texts: What can I do to break up long body text for a node?

texts:
I'm working with a dictionary database that has translations of a term that look something like this in the original excel files:

  water - [uo-tar] s. 1. Agua (H2O). Rain-water, agua llovediza.
  Fresh-water, agua dulce. Spring-water, agua de fuente o de manantial.
  Holy water, agua bendita. Well-water o pump-water, agua de pozo.
  Running water, agua viva o corriente. Salt water, agua del mar, agua
  salada. 2. Cualquier extensión determinada de agua; v. gr. un lago, un
  río, un mar. To go by water, ir por mar. High water, marea alta. Low
  water, marea baja. 3. Serosidad o humor de los animales;
  transpiración, lágrimas u orina.

The main word "water", the pronunciation "[uo-tar]" and the translation "s. 1. Agua (H2O)..." are separate fields. When importing the translation into drupal 7 using feeds I would like to be able to adjust the format of all the translation to something like this:

  water - [uo-tar] s.   Agua (H2O). Rain-water, agua llovediza.
  Fresh-water, agua dulce. Spring-water, agua de fuente o de manantial.
  Holy water, agua bendita. Well-water o pump-water, agua de pozo.
  Running water, agua viva o corriente. Salt water, agua del mar, agua
  salada. Cualquier extensión determinada de agua; v. gr. un
  lago, un río, un mar. To go by water, ir por mar. High water, marea
  alta. Low water, marea baja.Serosidad o humor de los
  animales; transpiración, lágrimas u orina.

I don't know if any one could give me some advice on different ways of doing this or if its even possible.

Thanks!


texts: I can't add new icons in CKEditor default toolbar

texts: I can't add new icons (tabs) in CKEditor toolbar, in EDITOR APPEARANCE options. Whatever I choose it only gives me default toolbar. I tried all versions. What should I do?


texts: Getting author_picture component values in twig

texts:
I'm making a theme where the author picture needs to be in one div, but some other fields from the user profile need to be in another.

The fields are all available in the author_picture variable - but I'm a little unclear in Twig how to split it apart into it's relevant pieces.

The author's pic appears to be called user_picture, and the fields are called field_bio and field_title.

I've tried different variations like

{{ author_picture.field_bio.value }} or {{ author.picture.user_picture.value }} etc - but to no avail.  What am I missing?


texts:
I'm using the Drupal Commerce module (http://www.drupal.org/project/commerce) along with the touchnet upay module (http://www.drupal.org/project/commerce_touchnet_upay).  I've been able to set it up so when a user clicks checkout, they are redirected to the touchnet site and are successfully able to pay.  However, there's nothing on the Orders page that shows that the Order is complete, they still say Checkout:Payment under Order Status.  This is the status of the orders that have gone to the payment site but did not pay as well as the ones that actually paid.

Does anyone have experience with using Touchnet and Commerce and can tell me how I can get this to change to Payment:Complete or what Touchnet sends to my site and how I can capture that so I know that the order was actually paid for?

Thanks for the help!


texts:
I was looking a module that implements single sign on for MS Windows networks. I found Webserver Authentication (https://www.drupal.org/project/webserver_auth). But I activated the module before configure it and now I can't access as ADMIN, or as any other developer user to keep working on the configuration of my project.

Does anyone had this problem before and can guide me to deactivate or uninstall that module??


texts:
I am using flag module to bookmark the content. Authenticated user can normally flag the content. For anonymous user when they click on flag link it should go to login page. After successful login it should flag the node automatically.
I have the code for flagging the content, but I could find how to flag after login.
$flag = flag_get_flag('wishlist');
$flag->flag('flag', $nid, user_load($uid), TRUE);


texts: Error in query : Call to a member function execute()

texts:
My query return me an error.
I have the gid of a organic group.
I want to retrieve the last news for this group.

 $query = db_select('node','n');
 $result = $query
 ->fields('n')
 ->condition('type','news','=')
 ->join('field_data_group_audience','fdga','n.nid = fdga.entity_id AND fdga.group_audience_gid = :gid', array(':gid' => $gid))
 ->execute();

This query give me a : Fatal error: Call to a member function execute() on a non-object

Thanks


texts:
I am working on a project where i would like to be able to create a search api view that has a relation to the referencing entity.

The use case:

I have a content type: Products page that holds the commercial information about the product

I then have a content type Product that holds all the specifics (article number, serial numbers etc)

I have created a search api view on the content type Products Page that shows all the commercial information in the catalog with some facets end an exposed full text search box.

Each product node has an entity reference to the Products page node it belongs to

Of course, i would like visitor to be able to search for article numbers in the fulltext search. The result needs to to show the Products Page node that is being referenced by the product node that holds the article number that was searched for.

However i cannot see how i can create the relation that you would normally use when using a regular view?

Addtionally and example below:

Products Page node: Chairs (with body and image)
Product nodes:
- Wooden chair (art nr 123, and entity ref to Chairs)
- Metal chair (art nr 456, and entity ref to Chairs)

So when ppl search art nr 123, i want my view to show the Products page node "chairs".

Thanks in advance!


texts: How to add variable using mytheme_preprocess_field and print using twig template?

texts:
We have a content type Article that has two custom fields: field_header and field_link. When field_header is not populated, we want to perform validation in twig template to add a CSS class. When we tried to set a custom variable using $variables['myVariable'] = TRUE and try to print the value in the twig template, it is returning a NULL value.

How can I create a custom variable using mytheme_preprocess_field() hook and use it in the twig template?

mytheme.theme

function mytheme_preprocess_field(&$variables) {
  $element = $variables['element'];
  if($element['#field_name'] == 'field_header') {
    if($element['#items']->first()->isEmpty()) {
      $variables['myVariable'] = TRUE;
    }
  }
}

node--article.html.twig

<div>
  {{ kint(myVariable) }} // Returns NULL everytime.

  {% if myVariable %}
    // If not empty, do something.
  {% else %}
    // If empty, do something else.
  {% endif %}
</div>


texts: No calendar showing on Rooms bookable unit - when clicking manage availability

texts:
I am not sure what I have missed. I first installed BAT module,but later decided to instead use Rooms module. I am under the impression that Rooms will make use BAT FullCalendar , I could be wrong. Unless if there are some configurations needed. Or must I uninstall BAT completely and only use Rooms module with a normal fullcaleder module? I have checked permissions but could not see anything funny. See attached.
Thanking you in advance.


texts: Can we create a core PHP file inside the files folder?

texts: As per Drupal's folder structure, custom code is always in sites/modules or in the theme folder. One of my colleagues created a custom PHP file in the files folder. Is this OK or are there any security issues?


texts:
What is the Drupal way of presenting multi-row, multi-column module data to the user in Drupal 6? Nothing jumped out in the API documentation. I was googling for some answers, but they all applied to earlier versions or referenced dead modules.

Am I correct in thinking that the out-of-the-box functionality for the forms API is basically a key::value editing interface? If that's the case, is there a current, well-maintained module to do this, or should I present this data in a different way for the user -- perhaps a view?

Edit I would like this table to have form features for editing the data, such as insert, changing cell data, etc. That's why I thought it would be natural for it to reside in the module's settings, but that table functionality does not appear to be there.


texts: How do I migrate relationships from json_api source?

texts:
I'm trying to merge content from two D8 sites, using the migration api and json_api as a source.  There are terms that have been migrated so I'm trying to migrate the relationships
Source data looks like:
field_topics
  data
    0
        type    "taxonomy_term--taxonomy_topics"
          id    "ab6ea190-3f59-4eab-a756-621e868d9f14"

process
  field_topics:
    plugin: sub_process
    source: field_topics
    process:
      target_id:
        plugin: entity_lookup
        entity_type: taxonomy_term
        source: id
        access_check: false
        value_key: uuid
        bundle_key: vid
        bundle: topic
        ignore_case: true

This returns data in the following format:
"field_topics" => array:1 [
    0 => array:1 [
      "target_id" => "32"
    ]
  ]

This relationship does not actually show-up when editing the node.
If anyone has an example of how to accomplish this it would be appreciated.


texts:
I currently use Drupal 7.0.

I am thinking that upgrading to 7.x-dev would resolve some performance issues I have.
Do you think that upgrading a production site to the development snapshot would break any possible database upgrade path?


texts: How to restrict users of other roles from seeing the site administrator details?

texts: I have created a role called "Site Admin" and created a user with that role. When i log in with that username.  "People" menu is showing in toolbar only when we give "adminster user" permissions to site admin. But when we give adminster user permission site admin can see and edit users in the site. These includes our main administrative users. How can i give permission so that site admin can only see the users excluding administrator user?


texts: Access denied page for users without permission "View published content"

texts:
My site access is only for registred users, then when you try to access drupal returns the "access denied" page. I want to customize my "access denied" page but the anonymous user doesn't have the "View published content" permission. Then they can't see a basic page node with my access node page customization.

How can I resolve this ?
-It can be a static html (but I don't know how to redirect when this error is raised). But drupal throws an error when I put in /admin/config/system/site-information because isn't a drupal path
-If is a node (my access denied page) how can I grant the anonymous users to view ?

I'm using Drupal 8


texts:
Apologies for the newb question, but: Is there a way to see the entire URL of a Services View I've created? I know it lets me name the path, however when I navigate to the URL, I get "View not found" (though the Views preview shows perfectly). I keep thinking maybe I'm just typing it in wrong? Right now, I'm navigating to:

http://domainnamehere.com/endpointname/views/viewname

Thanks all.


texts: Is there a way to create a Rules component programmatically?

texts:
Is there a way to programmatically create a Rules component?

I mean a component like the ones listed on /admin/config/workflow/rules/components.


texts: Include custom node id when POST'ing data through the REST API

texts: Is it possible to include a custom node id when POST'ing a node using the REST API? Knowing the node id in advance makes it easier to update the nodes in a future stage.


texts:
I am getting this error when I create a new wiki...does anyone have any idea why this is happening and how to solve it?

  Strict warning: Creating default object from empty value in
  PanelizerEntityDefault->hook_field_attach_submit() (line 1113

Thanks!


texts: Using an entity wrapper to change node->body value (with localization)

texts:
I try to programmatically modify the body of a node using an entity wrapper.
In my Drupal installation I also use Locale module (language for node is 'en', for body it is 'und') and Revisioning module.

Now, I've created a simple code to do this task:

<?php
// in database: field_data_body->body_value = 'old_value'
$node = node_load(1);

$wrapper = entity_metadata_wrapper('node', $node);

print_r($wrapper->body->value->value());   // prints 'old_value'
$wrapper->body->value = 'new_value';
print_r($wrapper->body->value->value());   // still prints 'old_value'

$wrapper->save();
node_save($node);
?>

yet it seems not to make any changes to the node.

Although, if I've tried to change the title:

$wrapper->title = 'ABC';

everyting worked fine.

I guess it's the problem related to using localization, but I can't find sufficient documentation on how to achieve what I want.

Could someone tell me how can I put it to work?


texts: Warning: Permission Denied, While clearing the cache

texts:
When I clear the cache of the site, I get lot of warnings with

  "Permission denied in drupal_unlink() (line 2199 of home/public_html/sitename/includes/file.inc)."

And I am unable to upload any default image to the site with the warning

  "File Could not be uploaded"


texts:
I'm seeking some help to better understand how to go about creating a custom search results page.  I've created search views and facetted search, but they really aren't what we are needing.  We are consolidating 4 indexes into one streamlined Drupal account and are needing our search to display results grouped by content type (basic filtering)...we were able to do this in search api (views) but we are also needing to display certain content a specific way.  For instance, images should have a thumbnail with no title.  Other pieces of content should just list the title name.  Here is an example of the search we're trying to replicate:  http://www.retrometrookc.org/. (Search for, e.g., belle isle.)

In theory this seems really simple but I can't seem to wrap my head around it.  If anyone has any suggestions or recommendation, I really would appreciate it!


texts: Should I use custom entity types and custom fields to represent complex data types, or is it better to stick with fields and field collections?

texts:
Since D7 is now coming up on EOL I need to begin planning the transition of a complex D7 site to D8/9. There are 2 particular data design issues I want to revisit. Number one is that I have a number of pieces of data that are tightly coupled to each node (i.e. external reference numbers) that do not need to be normalized on their own tables and revisioned. I would rather integrate them.

Two, I have about 18 multifields in place. In case you aren't familiar, this is like a field collection, but without an underlying entity, and that is for speed. They work as a sort of shortcut to bundle fields together into a single custom field without having to create custom fields in code.

If I were working with bare Symfony and Doctrine both of these would be easy to solve-I would just create exactly the entities I want and work with them on those terms. Since the main UI is headless there is something tempting about using Symfony as a framework instead of Drupal, but I think Drupal will make a more stable platform for other requirements.

So one proposed solution is to create custom entities that will encapsulate the tightly coupled fields and use my own entities instead of nodes as the base for the site. I would also directly create custom fields instead of using the multifield module. I don't know D8 well enough to know if by using a custom entity I might be giving up a lot of the convenience methods/integration that the node entity has.

Another route is continuing to use nodes, normalizing out the tightly coupled fields, and using field collections instead of multifield. In doing so, the underlying data structure is a worse fit but I stay on well-worn Drupal paths. I just don't know how performant this solution is, and how much it over-complicates external querying.

Last, I could skip Drupal and use Symfony and Doctrine, and import packages like Elasticsearch integration, logins and user role management through composer.

So my question really comes down to 3 points:
* Full Drupal or Symfony + composer installed packages
* Standard Nodes or Custom Entities?
* Custom-built fields or field collections?

Thanks for your consideration


texts: Is there a difference in #submit handlers when called through node forms rather than system_settings_forms?

texts:
I have a custom admin backend form where an editor can choose an "Active Header" for the entire site. Each header is a custom entity that stores certain values, such as the current logo, a primary color, and a base color.

I have the exact same #submit handler on both the custom admin form and set on hook_form_alter() for the Header entity.

Here is the code for the submit handler.

/**
 * Flushes header cache whenever a header is updated.
 */
function MYMODULE_clear_header_cache($form, &$form_state) {
  cache_clear_all('MYMODULE_header', MYMODULE_CACHE, TRUE);
  drupal_set_message('Header cache cleared.');
}

It is invoked on both the header form submit and the custom form submit, but the cache only actually clears when invoked on the custom form. When editing the header, it is necessary to submit the custom form before changes take effect, even though the exact same code runs in both cases (drupal_set_message() displays the message in both cases).

Can anyone please explain to me what's happening? I have tried everything I can think of, and the only surefire solution I can find is removing all caching on the header (which is definitely not desirable in my instance).

To preempt any answers I have already tried:

Yes I am using node_load() to obtain the header and render it into a block. I am resetting the node cache when calling node_load() (node_load($my_nid, NULL, TRUE)).
I have completely disabled block level caching on the header block.  It shouldn't make a difference considering the cache clears just fine from the custom form, but I tried it anyways.
I have tried using db_truncate(MYMODULE_CACHE)->execute(); to no avail.

So it seems that my header is getting cached elsewhere. Is there something special about system_settings_form() that flushes ALL drupal caches after submission?

Here is the full block rendering function.

/**
 * Builds main header.
 */
function MYMODULE_main_header() {
  $cid = 'MYMODULE_header:main';
  if ($cached = cache_get($cid, MYMODULE_CACHE)) {
    $header = $cached->data;
  }
  else {
    $header = array();
    $active_header = variable_get('MYMODULE_default_header');
    $node = node_load($active_header, NULL, TRUE);
    $alt =  t('My Site Name');
    // This is a helper function to add necessary punctuation to color values so they are usable as inline styles.
    $header['color'] = MYMODULE_fetch_primary(TRUE);
    $logo = array(
      'path' => $node->field_image['und'][0]['uri'],
      'width' => $node->field_image['und'][0]['width'],
      'height' => $node->field_image['und'][0]['height'],
      'alt' => $alt,
      'title' => $alt,
      'attributes' => array('style' => 'background-color: ' . $header['color']),
    );
    $image = theme_image($logo);
    $header['logo'] = l($image, '<front>', array('html' => TRUE, 'attributes' => array('style' => 'background-color: ' . $header['color'])));
    // A helper function to generate the nav menu.
    $header['menu'] = MYMODULE_top_menu();
    $header['dimension'] = $logo['width'] > 185 ? 'long' : 'tall';
    cache_set($cid, $header, MYMODULE_CACHE, CACHE_TEMPORARY);
  }
  // I keep forgetting forms break when they're cached.
  $search_form = drupal_get_form('MYMODULE_header_search_form');
  $header['search'] = drupal_render($search_form);
  return theme('MYMODULE_header', $header);
}


texts: How to use secondary database tables in new module of drupal 7

texts: I am developing new site i want to tie with the site with another database. is there any posibility to use secondary database tables in new module of the site.


texts:
I'm using Users Export that provides a hook with no extra information.
I need somehow to explore the $info parameters in order to this extra fields

my code:

function display_my_users_loft_data_grids_info_alter(&$info) {
    var_dump($info);
}

But in that case the var_dump doesn't work.

Does someone know any example or documentation or help me to debug that?


texts: Using a specific URL for a page within a multisite

texts:
I have a multi-site that I've got setup with a page created for a client, but they wanted a specific URL to point to it. For example, client.mywebsite.com/content/client-page should be only shown as clientwebaddress.com.

It's only a single page, so there's no kind of login, or further links. I had it set up through my DNS to just forward and mask the URL, except that wasn't working properly for them. It seems that some people didn't get redirected for some reason.

I've been told by server tech there's something I should be putting in the sites.php file, but as far as I'm aware, if I put the clients URL into my sites.php file (and change the DNS accordingly) it would just mean that their URL would work as an alternative to mine.

I know this is a pretty niche question, but it's not sure that the server tech is right.

Is there another way to do what I'm after?


texts: Setting a webform element's type programmatically

texts:
I've been working on creating a webform element programmatically. So far, I was able to set its maxlength and input_mask, but not its type. It is supposed to be a textfield. So, the maintainer pointed me to some example documents and I tried to copy it, to no avail. Below is my code to create it.

namespace Drupal\tckn_webform_component\Element;

use Drupal\Core\Render\Element;
use Drupal\Core\Render\Element\FormElement;
use Drupal\Core\Form\FormStateInterface;

/**
 * Provides a 'TCKN' element.
 *
 * @FormElement("tckn_webform_component")
 *  @see \Drupal\Core\Render\Element\FormElement
 *  @see https://api.drupal.org/api/drupal/core%21lib%21Drupal%21Core%21Render%21Element%21FormElement.php/class/FormElement
 *  @see \Drupal\Core\Render\Element\RenderElement
 *  @see https://api.drupal.org/api/drupal/namespace/Drupal%21Core%21Render%21Element
 *  @see \Drupal\webform_example_element\Element\WebformExampleElement
 */
class WebformTCKNElement extends FormElement {

  /**
   * {@inheritdoc}
   */
  public function getInfo() {
    $class = get_class($this);
    return [
      '#input' => TRUE,
      '#size' => 15,
      '#element_validate' => [
        [$class, 'validateWebformTCKNElement']
      ],
      '#pre_render' => [
        [$class, 'preRenderWebformTCKNElement']
      ],
      '#theme_wrappers' => ['form_element']
      ];
  }

  /**
   * Webform element validation for the TCKN element
   */

  public static function validateWebformTCKNElement(&$element, FormStateInterface $form_state, &$complete_form) {

  }

  /**
   * Prepares a #type 'text' render element for theme_element().
   */
  public static function preRenderWebformTCKNElement(array $element) {
    $element['#attributes']['type'] = 'text';
    Element::setAttributes($element, ['id', 'name', 'value', 'size', 'maxlength', 'placeholder']);
    static::setAttributes($element, ['form-text', 'webform-tckn-element']);
    return $element;
  }
}

What am I missing?


texts: Can I have a webform in sidebar block reload current page

texts: I have a webform in my sidebar as a block. If I set Redirection location to No redirect (reload current page), it loads the form url in the main content. I can understand why it's doing this, but I would like it to reload the current page instead (or submit the form with AJAX but that's not necessary). Is there any simple way of achieving this?


texts: I am using the profile2 module in Drupal 7. I have created a field using the check box/radio widget that has 2 options and both options can be checked. How would I be able to create a sub-field that will show another checkbox/radio widget with options depending on what was checked in the main field?


texts: Access custom block link field url in twig template

texts:
I have a custom block with four fields like this :

I want to display in twig the value of image's uri. I've tried something like that in field--block-content--field-linkedin-link--rs.html.twig template:
{%  for item in items %}
   {{ file_url(item.entity.uri.value) }}
{% endfor %}

and this :
{%  for item in items %}
    {{ item.0['#url'] }}
{% endfor %}

Nothing works.
Any idea please?
Thanks a lot


texts: How to apply or assign custom view mode to user display?

texts:
I am using Display Suites. I have created a custom view mode and have made it available to the user display per Display Suite documentation, but I cannot figure out how to apply the custom view mode to the user display.  It always shows in the default view mode.

If I were editing a node, there would be a vertical tab called Display Settings that would have a field for selecting the view mode to use.  When editing an existing user profile, there is no Display Settings tab.

In various Drupal issues queues, specifically Display Suites, Panels and Profile 2, other users have asked essentially this same question: How do I assign a custom view mode to the user profile display?

Is the Drupal core responsible for user data and display?  Perhaps the problem lies there instead of with whatever module.


texts: Simple order cancellation in Drupal Commerce, with 24 hour time limit?

texts:
I want to create a way for customers to log in and edit their completed orders (the orders are registrations to classes). Compared to the standard order-edit page I want to remove all options except 'change order status to cancelled'. Preferably a simple page stating the content of the order, then some cancellation 'rules', and then a button saying 'cancel this order'.

Cancellation should then also check whether date/time of the booked class is less than 24 hours away from the moment of cancellation. If <24 hours, it should either refuse cancellation, or allow cancellation (nice for those on the waiting list), but not refund the cost of the class (paid for using a voucher - using the giftcard module)

Background: the site sells two products: one is a set of vouchers. These vouchers can then be used to buy product 2, which is a registration to a class at a specific date and time. When customers have booked a class, they now get an email with link to their order page. Their they find a button 'edit order', click that and you go to the standard order edit page which shows line-items, billing and shipping etc, and allows all existing changes to the order status. As this page is not made trough either a template or a view, I have no clue how to change what customers get to see and do with their completed order.

Also rules does not allow me to compare the time of the status change with the time/date field of the booked class, so I can't control the 24 hour limit either..

Suggestions are to build a custom module doing the above, but I have no idea how to kick that off..

All/any help massively appreciated


texts: I don't have an external crontab set up for my Drupal site.  How can Drupal search for updates in this case?


texts: Drupal 7 Commons 3 Vs Drupal Core + Commons modules

texts:
I read Drupal Commons 3 and Original Drupal Core Updates and I wonder what the difference between installing the Drupal Commons 7 distributions and installing Drupal 7 plus the Drupal Commons modules available freely on Drupal.org is.

It seems to be safer to use Drupal core and the modules, and not to rely on entire distro updates.


texts:
I install Nodejs integration module in drupal7, then install Nodejs package on CentOS 6.4; In instruction nodejs integration i see:
'In your terminal window, start the node server using the following command:'

node server.js

but in module directory, i haven't file "server.js"

can anyone help?


texts:
I have optimized to combine all CSS and JavaScript files in my site.

.

If I run Yslow in Firefox to see the components loaded for this site, it shows that it loads 8 JavaScript files, and 8 CSS files.

Why aren't these files combined?


texts: DB Query replaces %s inside LIKE operator

texts:
I have one query like :

db_query("SELECT * FROM {foo} WHERE bar LIKE '%supply%' LIMIT %d,%d", 0, 10)

Now if I use db_query API it will replace %s with the argument supplied and resulting query will be like

SELECT * FROM foo WHERE bar LIKE '0upply%' LIMIT 0, 0

Any ideas to overcome this ? I dont want to use mysql_query()

I am using temporarily _db_query()


texts:
Is there any way to change taxonomy menu links depending on path? I have a Taxonomy menu in a block with different levels and depending on path I would like to change the taxonomy level depending where the user is. Context maybe?

Thanks in advance!!


texts: How to allow access to nodes with terms that match the terms in a user profile?

texts:
I try to create a site based on D7. I have an issue and I don't have any idea how can I solve it.

A user should have two term reference fields in the user's profile. And a node should have the same node reference fields to the same taxonomy vocabularies. If a user's profile contains the same terms as the terms in a node, then the user has read access to the node.

For this issue, a very suitable module is the Access By Term module, but this module uses OR-logic, instead I need AND-logic. In other words, the user should only have access to nodes which have both of these TWO terms, not only one of these terms.

Any help?


texts:
Is it fair to say that aggregator is retained in d7 core for legacy support, and that Feeds is the likely successor?   Feeds covers more scenarios than aggregator, and appears to be better situated for adaptions, although the generalization makes it more difficult to understand how to go about implementing.    Are there projects that you can recommend that build on themes to implement particular use cases?

--- Looking through the Feeds documentation, we find the statement

  "Feed: aggregation importer. Aggregates RSS/Atom feeds to nodes.
  Provides a node type Feed and a node type Feed item. Create one or
  more "Feed" nodes to add RSS/Atom feeds to your site. On cron, these
  feeds will continuously produce "Feed item" nodes. Requires the
  Aggregator core module to be enabled.

So project/feeds depends on core aggregator, although it seems to overlap and extend functionality as well.


texts:
I used the Taxonomy View Depth module to create a taxonomy vocabulary like this.

Animal

Cats

Brown
white

Dogs

Brown
White

What I did was enabling the default taxonomy view, and changing the depth in Content: Has taxonomy term ID (with depth) to 1 instead of 0 (also tried 2,3, etc.)

The children items will never show on the page. It does remove the There is currently no content classified with this term. from the page.

What I want? With Taxonomy menu I want to be able to click Cats and show the second level children.


texts: Intregrating Media-7.x-1.5 Module in CKEditor 4.4.3 (7.x-1.16) with Picture Module

texts:
I am not able to upload image with picture tag inside CKEditor.When i upload image,media automatically defaults it to mobile image(lowest in the picture mapping) in the picture group without showing the rest of the source(i have selected the view mode with picture).Rest of the images without picture tag are output correctly.

Also "Convert Media tags to markup" - enabling or disabling it in the Text Format in the configuration doesn't have any effect.What changes should I make in the configuration to get picture module work with Ck editor using Media module?


texts: How to attach a library to a specific content type?

texts:
I wonder how to attach a library to a specific content type. .e.g News. I found the following code from a post and applied the "hook" to the "node" but no idea how to filter by content type. Any idea?

function fluffiness_preprocess_node(&$variables) {
  $variables['#attached']['library'][] = 'fluffiness/cuddly-slider';
}

ref:
https://www.drupal.org/docs/8/theming-drupal-8/adding-stylesheets-css-and-javascript-js-to-a-drupal-8-theme


texts: Why are all of the non-value columns indexed, but the value column isn't?

texts:
I'm working on improving performance for a Drupal 7 website and noticed that all of the non-value columns (entity_type, bundle, delete, etc) are indexed, but the actual value field isn't...does this make sense to anyone?

I know Drupal uses the other fields to join against other tables, but any views/custom queries that are searching for nodes with specific field values are going to suffer are they not?

Is there some reason why the value column isn't indexed by default? Will it cause problems if an index is added?

The specific field I'm looking to index is a date field if that provides any more insight into the situation


texts: Order style-sheet list when adding custom one via template_preprocess_page()

texts:
I'm using phptemplate_preprocess_page() to add a set of style-sheets which are only needed for a certain content type.

function phptemplate_preprocess_page(&$variables) {
  if ($variables['node']->type == 'example') {
    drupal_add_css(path_to_theme() . '/css/example.css');
    $variables['styles'] = drupal_get_css();
  }
}

The problem is that my added style-sheet is added to the top of the list, which results in undesired behavior. For example, let's say that in my main theme style-sheet I define the font-size of p to be 11px, but in my example.css for this specific content type I need it to be 15px. The main style-sheet is added via the .info file of the theme.

It seems I can only think of icky ways to add my specific style-sheet at the bottom of the list, or at least below the theme default ones.

Is there any proper way to order them?


texts: what is the difference between commerce order table and commerce line item table?

texts:
which table should i consider for created date for an order in commerce_order table and commerce_line_item table.

I can see created dates in both the tables.


texts:
I have tried to put this code in custom block with input formated to PHP code:

$settings = theme_get_settings('my theme');
if (!$settings[toogle_logo] = 0) {
  print '<img src="' . base_path() . $settings['logo_path'] . '" alt="my logo" />';
}

It doesn't work in Drupal 7.


texts: Commerce partial payment : pay deposit at checkout and full settlement later

texts:
In a Travel Booking website, how can I configure checkout so that customers pay only a n% deposit of the order total at checkout (off-site payment ATOS solution) ?

If the order is created :

less than 30 days before departure, customer pay 100% of order total at checkout.
between 30 and 90 days before, they pay 30% at checkout.
more than 90 days before, they pay 10% at checkout.

Full settlement must be paid before travel departure (reminder emails)...

There are few contrib modules about deposit or partial payment :

I had a look at Commerce deposit sandbox but it seems to be a per product solution, while I need a global cart approach.
I began to hack Commerce Partial Payment for my own need. The module alters checkout_form_alter and provides a textfield where the customer can input a deposit value just before payment, so I pre-calculated deposit amount as per my rules above, filled the field with it, and hide it.

/**
 * Implements hook_form_BASE_FORM_ID_alter().
 *
 * Alters whichever commerce checkout page includes the commerce_payment
 * checkout pane and adds the amount element to the payment details.
 */
function commerce_partial_payment_form_commerce_checkout_form_alter(&$form, &$form_state, $form_id) {

  $panes = commerce_checkout_panes(array('pane_id' => 'commerce_payment'));
  $checkout_page = $panes['commerce_payment']['page'];
  if ($form_id != "commerce_checkout_form_$checkout_page" || !commerce_partial_payment_access($form_state['order'])) {
    return;
  }

  //setting up my own deposit value
  $deposit = vts_commerce_deposit();

  // If a values has already been set then use it as the value for the amount.
  // Otherwise, default it to the balance of the order.
  $default = NULL;

  if ($deposit > 0) {
     $default = $deposit ;
  }
  elseif (isset($form_state['values']['commerce_payment']['payment_details']['amount'])) {
    $default = $form_state['values']['commerce_payment']['payment_details']['amount'];
  }
  else {
    $balance = commerce_payment_order_balance($form_state['order']);
    $default = commerce_currency_amount_to_decimal($balance['amount'], $balance['currency_code']);
  }

  // Add the amount to the payment details form.
  $form['commerce_payment']['payment_details']['amount'] = array(
    '#type' => 'hidden',
    //'#title' => t('Amount'),
    '#weight' => -10,
    '#required' => TRUE,
    '#default_value' => $default,
  );
}

But I got stuck there because that value,  passed to $form['commerce_payment']['payment_details']['amount'],  is not the one sent to the remote payment server (so that AFAIK, this module can't work)...

I also tried to set any other parts of checkout_form_alter ( $form and $form_state) where the order amount was repeated with $deposit, this NEVER changes the value set for payment at next step...

Question(s)

Using the above solution, at what point of checkout / which form can I alter the amount to be paid, replacing order total by deposit value ?

Indeed, I couldn't find how to separate the order total from the amount to pay... with correct data along the process : order total / paid deposit / balance order to pay later.

If there is a more D7 commerce way to implement this deposit issue, with rules or whatever, I'll be glad to learn it.


texts: How to set a default image on a Drupal 7 Media field

texts:
I have a non-required field_thumbnail that is of type "Multimedia asset", and the widget type is "Media file selector".  However on the field's settings page there is no option to specify a default value.  I've also perused the Administrative section seeking configuration in the Image styles, and File styles, but neither permit a default image to be used.

What would be the recommended way to get a default image, when a user does not select any media object for the given node?


texts: After registration password : Your password is not correct

texts:
Once i registered my account with email and username, mail from account settings is getting. In that mail Password : Your password is displaying. If i used that password, it shows incorrect. I check ed in my account settings, its shows
username: [user:name]
password: Your password
What i need to change to get the correct password in mail


texts: Media module function overriting, user can see only own media

texts:
As title says, I need to override few media module functions and add some extra conditions when selecting media. I wanted to create new module that extends media module and overrides those functions but without success.

I wanted to override function

function media_admin_list(&$parent_form)

and to add this line so media module will select media from logged in user

$query = db_select('file_managed', 'f')->extend('PagerDefault')->extend('TableSort');
$query->join('users', 'u', 'f.uid = u.uid');
$query->fields('f', array('fid'));
$query->fields('u', array('uid'));
$query->condition('f.status', FILE_STATUS_PERMANENT);
$query->condition('u.uid', $user_id, "=");
$query->limit($limit);
$query->orderByHeader($header);

As you can see in code above, we have condition for selecting media from specific user.

Please advise how to override this function in my own module.

Thanks.


texts:
To get straight to the point, there are times when I may not want to render anything. Some condition failed and I now want to display an error for the admin/developer and skip rendering a template file so the front end isn't affected.

The context would be in a preprocess function. In this case I'm using hook_preprocess_entity. I check for a condition and if it fails, I want to skip the template. I'm thinking this hook may be too late since it's already decided that a template file should be used. But I don't think there's a hook that I can reliably use to intercept this.

I've been digging in core's theme.inc but can't figure it out.

I tried resetting the theme_hook_suggestions
 and theme_hook_suggestion but it seemed to still default to a template file.

I've tried moving my check into the template file itself (I don't like this one but though, it stinks), but I have to break out of php and return some empty html (blank space/line seems to work); Otherwise Drupal seems to move onto the next template suggestion. Really weird.

Current workaround is registering a new template file with hook_theme and having just a blank line in that template file. If my check fails I set this file as the theme_hook_suggestion.

Hope all that makes sense.

Does anyone know how to do this?

Edit

function HOOK_preprocess_entity (&$variables) {

    if (something_is_not_true()) {
        drupal_set_message('Some error message', 'error');

        // somehow don't render the template here

        // current workaround
        $variables['theme_hook_suggestion'] = 'error_helper';

        return;
    }

    // normal preprocess stuff
}

Edit 2

To answer @BeeBee - I'm using the Bean module and have a custom block type with an entity reference field.

When we develop and add a new content type to be selectable in the entity reference field, nodes of that content type have to get their data parsed/formatted a certain way to use a certain template file. There is no fallback and we don't want one as it would make the front end look bad for the end user. It's really an all or nothing type deal.

So if I or Another Developer have not set this data parse/formatter up for the newly supported content type yet then I'd like to not render the block and show a helpful error message to the developer as to what he/she has to do to get this working.

So the condition is if the referenced entity is not one of the explicitly stated supported content types then don't render the block (well I guess bean entity) and set an error message.


texts: How to track and notify employees when their certifications have expired?

texts:
I am creating a Drupal 7 site where it tracks an employee's certification status, and notifies them if it has expired/is about to expire.

Currently, I have a content type called "Employee Info," where different types of certifications (under the "certifications" field, a list type) can be checked off for each employee, depending on which certs their job requires them to have.

For example, say I'm entering Billy John as a new employee who was certified in CPR, Cycling, but not Swimming. The CPR certification only lasts one year, and the Cycling cert lasts two. I would like it so the user can enter that Billy was certified for CPR on say, 1/1/15, and Cycling on 6/1/15, once their respective box is checked. Then, when 1/1/16 has rolled around, they get the notification that their CPR certification has expired (and likewise on 6/1/17 for their Cycling cert).

However, I am unsure how to do this, or if this is even the best approach to the problem.

Any help or guidance would be greatly appreciated!


texts: How do I customize the location of a webform for a node type?

texts:
I'm customizing a node type and need to add a webform using the webform module. How do I add the webform in a custom location without having a machine name for the webform?

In the code below for example, I want to populate body content followed by the webform:

<div id="content">
    <?php print render($content['body']); ?>
    <?php print render($content['WEBFORM?!?']); ?>
</div>

And, yes, I know about displays and how you can change the location of a webform there - my node is too customized.


texts: How to show translated taxonomy terms in term listing in content listing style

texts:
I have question about translation of taxonomy terms in Drupal 8. Let's assume this configuration:

New created vocabulary, vocabulary language - not specified, terms language - not specified, show language selector, enable translation.

With this config, I should be able to translate new created taxonomy terms, if I select specific language while creating one. So I create taxonomy term in English language. Then I go and translate that term by clicking the "translate" tab in this term. I fill all values and save the form. Term is now translated to another language.

And now comes the difference - when I do the same approach with content, in content overview I see all nodes - original, and also translated. When I do this with taxonomy terms, in vocabulary listing I see only taxonomy term which was created first (so in my example the English one) - see the image.

How can I achieve the same behaviour as in content listing? I am expecting, that all terms will be listed here (as in content overview), or at least, when in specified language, terms with this language set should be shown (e.g. in English only links in english translations, if they exists). Taxonomy terms and nodes are all entities, so I would expect the same behaviour while translating them... Or is this a bug?

Thanks


texts: how to check if javascript is enabled in a module drupal7

texts:
I'm building a simple module that shows a jQuery UI dialog.
I have some HTML in my code but I only want to show this to users that have javascript enabled.

to give you an example here are the contents of my .module file:

function popover_init() {
    drupal_add_library('system', 'ui.dialog');
    drupal_add_js(drupal_get_path('module','popover') . '/popover.js', 'file');
}
?>
<div id="dialog" title="D7 jQuery dialog">
    <p> bla bla bla </p>
</div>

How do I check the drupal way that javascript is enabled so I can stop my module from loading unnecessary stuff ?


texts: How do I display an entire node content on the front page?

texts: How do I display an entire node content and not just some intro text on the front page? It seems anything I promote to front page, is also truncated and I can't figure out how to turn this off.


texts: How to declare a field in a custom entity as a geofield for leaflet views integration

texts:
I am trying to use leaflet with a custom entity that has geocodes in them.

Below is the custom entity called Places.

function places_schema() {
$schema = array();

$schema['Places'] = array(
  'description' => 'Places',
  'fields' => array(
    'PlacesId' => array(
      'description' => 'PlacesId',
      'type' => 'serial',
      'not null' => TRUE,
    ),
    'Address1' => array(
      'description' => 'Address1',
      'type' => 'varchar',
      'length' => '255',
      'not null' => FALSE,
    ),
    'Address2' => array(
      'description' => 'Address2',
      'type' => 'varchar',
      'length' => '255',
      'not null' => FALSE,
    ),
    'City' => array(
      'description' => 'City',
      'type' => 'varchar',
      'length' => '255',
      'not null' => FALSE,
    ),
    'State' => array(
      'description' => 'State',
      'type' => 'varchar',
      'length' => '255',
      'not null' => FALSE,
    ),
    'ZipCode' => array(
      'description' => 'Zipcode',
      'type' => 'varchar',
      'length' => '255',
      'not null' => FALSE,
    ),
    'GeoLat' => array(
      'description' => 'Latitude',
      'type' => 'geofield',
      'not null' => FALSE,
      'precision' => '10',
      'scale' => '6',
    ),
    'GeoLon' => array(
      'description' => 'TODO: please describe this field!',
      'type' => 'geofield',
      'not null' => FALSE,
      'precision' => '10',
      'scale' => '6',
    ),
    'County' => array(
      'description' => 'Longitude',
      'type' => 'varchar',
      'length' => '255',
      'not null' => FALSE,
    ),
    'SortOrder' => array(
      'description' => 'Sort Order',
      'type' => 'int',
      'size' => 'big',
      'not null' => FALSE,
    ),
    'Type' => array(
      'description' => 'Type of Address',
      'type' => 'varchar',
      'length' => '255',
      'not null' => FALSE,
    ),
    'GeoStatus' => array(
      'description' => 'Goecoded or not',
      'type' => 'varchar',
      'length' => '255',
      'not null' => FALSE,
    ),
  ),
  'primary key' => array('PlacesId'),
  'indexes' => array(
    'City' => array(array('City', 15)),
    'County' => array('County'),
  ),
);
return $schema;
}

I can get the handlers to work but when I go to settings on the leaflet map in views it does not recognize my geofields.

class PlacesViewsController extends EntityDefaultViewsController {

public function views_data() {

        $data = parent::views_data();

        $data['Places']['GeoLat'] = array(
            'field name' => 'GeoLat',
            'title' => t('Latitude'),
            'help' => t('Geo Latitude for a Place'),
            'field' => array(
                'handler' => 'geofield_handler_field',
            ),
            'filter' => array(
                'handler' => 'geofield_handler_filter',
            ),
            'sort' => array(
                'handler' => 'geofield_handler_sort',
            ),
        );
        $data['Places']['GeoLon'] = array(
            'field name' => 'GeoLon',
            'title' => t('Longitude'),
            'help' => t('Geo Longitude for a Place'),
            'field' => array(
                'handler' => 'geofield_handler_field',
            ),
            'filter' => array(
                'handler' => 'geofield_handler_filter',
            ),
            'sort' => array(
                'handler' => 'geofield_handler_sort',
            ),
        );

        return $data;
}

}

Looking through the geofield modules there is a field formatter for geofield_lat and geofield_lon.  So I would think it would pick this up.

Do I need to implement hook__entity_property_info_alter?


texts: How do I apply cufon.js only for Internet Explorer, in template.php?

texts:
I have some font problems in Internet Explorer, so I am trying to apply font-family through JavaScript. It works, but the JavaScript code runs for every browser.

How do I run JavaScript code only on Internet Explorer?

This my code.

drupal_add_js('sites/all/themes/blogbuzz/js/cufon-yui.js');
drupal_add_js('sites/all/themes/blogbuzz/js/Helvetica_CE_35_Thin_100.font.js');
drupal_add_js('(function ($) {
  $(document).ready(function() {
    Cufon.replace("#content-header");
    Cufon.replace("#client_tle");
    Cufon.replace("#block-block-16");
  });
})(jQuery)', "inline");


texts:
We have a problem with search only indexing fields that have their "Field visibility and permissions" either set to be "Public" or "Custom" with the anonymous user able to view. Any field that is private or has some other custom setting isn't indexed.

I only use Drupal occasionally so I'm far from an expert but as far as I can tell reading around, search should index everything except if it's explicitly told not to.

I've searched around and can't find any setting that would seem to be causing it to behave in this way.

Have I misunderstood how it should behave or is there a setting somewhere I'm missing?

cheers, Gordon

EDIT: I realise that I should have specified that the site is using the Field Permissions module to set the permissions on each of the fields.


texts: How to make a View only show it results if the last of multiple exposed filters has a value selected?

texts: I have a View with three exposed filters. We do not want to show any results until the user has selected a value for the last filter. Is this possible?


texts:
I want to use different node templates if the url is appended with ?template=x

Content type is called image

Default Node template using node--image.tpl.php:

blakedesign.co.nz/testsite/node/1

Same node with different template via URL possibly node--image--templateX.tpl.php:

blakedesign.co.nz/testsite/node/1?template=2
blakedesign.co.nz/testsite/node/1?template=3
blakedesign.co.nz/testsite/node/1?template=4

How do I go about doing this?


texts:
I have a Drupal 7.x intranet and I am using the Apache Solr Search module as the backend (basic out of the box setup). My site has content types and custom fields, but it is not using tags/taxonomy, etc.

I was able to do basic customization on my search as to what content type search results come first, weight, etc.

However, I have a business need to be able to control my search results in a way that will allow me to do the following:

Search for the word "USA" and the results returned in my search to
include nodes containing America. Is there a way to do this without something like adding a hidden taxonomy/term field to my content type and specifying "USA, America"?
Search for the word "Mandarins" and return results that do not have the word "Mandarins" but instead are in a way related (parent/child), so it would return a "QC Procedures" node from our "processes and procedures" content type? A good example of this would be searching for "Son" and the search returns Father, Mother, Brother, Cousin nodes that show up. Somehow establish parent/child/relationships between these nodes/content types that the Drupal search understands and follows.


texts: Is there a module to conditionally set a fields value depending another field?

texts:
is there a module that can set a value of a field which depends on the value of another field first? I know i can do it via js, but was wondering if something was out there already. conditional field module doesnt work in my case as it dosent set the value depending on the result of another.

example: I am creating a basic page and I have a select box field with the following: white/black/red. when i select red, i want the body to be filled in with 'yes' and if its black i want the body to be filled in with 'no'.


texts:
It is posible config webform for read but not submmit?
I need that anonymous user see webform but only authenticated user can send.


texts: Show price with discount in the "add to cart confirmation" popup in Commerce Kickstart?

texts:
I'm using the Commerce Kickstart distribution for a e-commerce site.

I create a rule to apply a price discount to a product which is fired when the buyer enters a code.

The discount works fine, but when I add the product to the cart a popup shows up to notify you that the product has been added to the cart (and give you the option to continue shopping or go to the cart). In this popup, created with a view the module defines, the price for the product is shown without the discount.

I need to show the price with the applied discount. How can I do this?

I also need to show a message inside this popup, something like "You get the discount!" I already added a second action to the rule to show this message, but I don't know how to show it inside the popup.

How can I show a system message inside a view?


texts: How to change Taxonomy admin page title?

texts:
I simply need to change the title on the (Drupal 8.8.4) administrative page which lists the existing vocabularies.

As far as I know/read, the routing.yml should be modified, shouldn't it?  (Is only the *defaults_title parameter that needs to be changed?)

Inside the taxonomy.routing.yml file, I only get the form routes for taxonomy term, if I am correct.

Do I need to modify the route elsewhere?

I have tried with the system.routing.yml file, listing many administrative routes (I thought it was the jackpot) but there is no route for the taxonomy page.

Could someone tell me where to go and which static route to change?

Related questions

How do I set the page title?
How to set admin theme for a route?


texts:
In Drupal 7 I'm trying to accomplish the following:

1) www.domain.com          =   ViewA (All posts)
3)  www.domain.com/muffins  =   ViewA (Posts tagged with "Muffin" taxonomy)
4)  www.domain.com/cookies  =   ViewA (Posts tagged with "Cookie" taxonomy)
5)  www.domain.com/...      =   ViewA (Posts tagged with ... taxonomy)

I have a view, listing posts, with only one contextual Filter of "Category" (my vocabulary containing the required taxonomy), which works when tested in views.

I can set ViewA as the homepage, satisfying 1) but subsequent pages 2),3),4) are not handled by ViewA. Instead they return page not found as Drupal isn't aware that ViewA can handle the requests.

I know I can create a second page view ViewB with an additional url path segment like this:

www.domain.com/recipe/muffins  =   ViewB (Posts tagged with "Muffin" taxonomy)

But then all of my content has to live one "level" down under /recipe — which is not ideal.

Also, since the taxonomy grows as more recipes are added, hard-coding menu paths in a module is no a solution... or is it?

Any suggestions would be helpful.


texts:
Ok drupalers,

A good one.  I am using the MMenu module to implement right hand side overlay panels.  The site that I am building has two different types of users "Group A" and "Group B".  They each need to see different content displayed inside of the right hand overlay created by the MMenu module.

Problem: MMenu module displays the same content on ALL the pages for "Group A" and "Group B".

The site is a demo site for anonymous users to review, so there are no user login url's to distinguish a user in Group A from a user Group B.

basically, I need a way to dynamically change the content block based on what page loads.

Anybody got any good ideas?


texts: How to send a custom Solr Distance Query with SearchApi

texts:
My nodes have a geofield and my search query should find all the nodes within a range.

I've managed to create a search form against my Solr Server with views. But I want to do the request by myself (having my own form and submit method). There's a solution for D7 here: How to send a custom Solr Query using Search API Solr but none of that seems to be usable with the D8 modules.

I believe there must be something like

$result = SolrSearchService('myServer', 'myIndex')->request(['title' => 'Test']);

But I can not find anything.

The views-built search page renders a query against my Solr Server like

path=/select params={q=(phonm_rendered_item:nintendo^1+tm_title:nintendo^8)&json.nl=flat&pt=48.1371079,11.5753822&d=50&omitHeader=true&fl=ss_search_api_id,ss_search_api_language,score,fts_field_geo_koordinaten__distance:geodist()&start=0&fq=%2Bindex_id:default_solr_index+%2Bhash:ozztjn&fq={!geofilt}&rows=10&sfield=locs_field_geo_koordinaten&wt=json}

Apparently there are some parameters responsible for the distance calculation:

pt=48.1371079,11.5753822 - it's where I am
d=50 - it's the max distance
field_geo_koordinaten - it's the geofield in the node
geodist() - the function ?

How can I render such a query with Search API?


texts: how to fetch webform records from table by using drupal db_select

texts:
i want to display the output in the following format by using the following source code but the following source code shows error

  Notice: Undefined offset: 0 in eval() (line 20 of /....----modules/php/php.module(80) : eval()'d code).

<?php
include_once(drupal_get_path('module', 'webform').'/includes/webform.submissions.inc');
$query = db_select('webform_submitted_data', 'u');
$query->fields('u', array('sid','nid','data'));
$query->condition('nid','1','=');
$results =$query->execute();

echo "
";
echo "
";
echo "  Profile Photo 	";
echo " Faculty  Name and Department  	";
echo  "
";

if($record = $results->fetchAssoc())
{
$sid = $record['sid'];
$nid = $record['nid'];
$submission = webform_get_submission($nid,$sid);
echo "
";
$val = $submission->data[15][0];

$query1 = db_select('file_managed', 'u');
$query1->fields('u', array('fid','filename'));
$query1->condition('fid',$val,'=');
$results1 =$query1->execute();

if ($record1 = $results1->fetchAssoc())
{
$path = $record1['filename'];

echo "   	";
}
echo "" .  "Name : " . $submission->data[1][0] . "
" .  " Designation : " . $submission->data[2][0] . "
" . " Department : " . $submission->data[3][0] ."
" . " E-mail : " . $submission->data[4][0] .  "	";
echo "
";
}
echo "
";

?>


texts: Custom layouts in panels not allowing me to add content

texts:
I created custom layouts for panels in my theme/layouts folder which I linked up in my .info file.

When I create a new one I am able to select it as a layout in panels, but when I click the content tab the sections aren't there.  I've cleared the cache via admin and via drush at least a thousand times.  Last time this happened to me I downloaded the latest version of Panels and it seemed to fix the issue, except I added another layout after that and I'm getting the same issue.

As an example, this is what my content tab looks like for my variant.  http://cl.ly/image/343N0V133R24.  Any ideas why this is happening?  It seems like panels is caching for some reason, but I can't find a way to make it stop.


texts:
i've problem using db_select it return strange object instead of the result
here is the code

function _table_subscrib(){
  $result = db_select('user_company','uc')
->fields('uc',array('user_company_uid','user_company_nid','user_company_sub_number','user_co    mpany_date'))
          ->extend('TableSort')
         ->extend('PagerDefault')
         ->limit(50)
         ->execute();

$header = array('User Name','Company Name','Subscribtion Number','Date');

$rows = array();
while($data = $result->fetchAssoc());
{
    $rows[] = array(
        $data['user_company_uid'],
        $data['user_company_nid'],
        $data['user_company_sub_number'],
        $data['user_company_date']
    );
    drupal_set_message("ssdsd");
}

$output = theme_table(
            array(
                "header" => $header,
                "rows" => $rows,
                "attributes" => array(),
                "sticky" => true,
                "caption" => "",
                "colgroups" => array(),
                "empty" => t("Table has no row!") // The message to be displayed if table is empty
                )
            ).theme("pager");

return $output;

}

here is the object returned too

DatabaseStatementBase Object ( [dbh] => DatabaseConnection_mysql Object ( [shutdownRegistered:protected] => [target:protected] => default [key:protected] => default [logger:protected] => [transactionLayers:protected] => Array ( ) [driverClasses:protected] => Array ( [SelectQuery] drupal......

thanks


texts: Conditionally hide the node comments via preprocess function

texts:
I have learned how to hide the display of the author and the creation date of a node, depending on the content of a taxonomy field.
Is it going to hide the comment on the same way?

function mytheme_preprocess_node(&$variables) {

  // check if this is the right content type where the field exists
  if ($variables['node']->getType() != 'article') {
    return;
  }

  // taxonomy field
  $field = $variables['node']->field_where_to_publish;

  if (!$field->isEmpty() && $field->entity->label() == 'public') {

    // How to hide the comment for this entity label?
  }

}


texts: How to list nodes that share one or more of the same entity references as the current node

texts:
I have three content types Projects, Campaigns and Blog Posts. Campaigns and Blog Posts share an entity reference field that allows for selection of one or more related Projects.

I currently have a View with block that is displayed on the individual Project nodes and lists Blog Posts that are related to that Project. There is a contextual filter to compare the array of related (Project) nodes within the Blog Posts with the ID of the current Project node. I want to add the same type of list to the individual Campaign nodes.

The Campaign nodes will have one or more referenced Projects and the Blog Posts must be compared to see if they share any of the referenced Projects in common.

For example Campaign 1 with references to:

(Project 1, Project 2, Project 3)

should show related Blog Posts with either:

(Project 1)
(Project 2)
(Project 3)
(Project 2, Project 3)
(Project 1, Project 3)
(Project 1, Project 2)
(Project 1, Project 2, Project 3)

I have read and tried a couple of possible solutions to configure the contextual filters and relationships, but nothing is working; the results are blank. I know for a fact that there is a Blog Post and a Campaign that share at least one common Project reference. So the results should show at least that one Blog Post.

Any ideas? Clearly defined configuration options would be appreciated.


texts:
Keep showing log message
How can I disable this message?


texts: How to refer paths relative to the theme directory?

texts:
I have a theme called Eternal with the following data in it's eternal.info file-

name = Eternal
description = A Customized Drupal 7 Theme
core = 7.x
engine = phptemplate

In the template folder lies the page.tpl.php. Under the /themes/ folder, the address becomes -

/eternal/templates/page.tpl.php

There are several lines inside the page.tpl.php that require I define a path for an image, like so-

The /images/ folder is located inside the /eternal/ folder, so to access it from /templates/ one would need to travel one level up and then access the /images/ folder. That would look like this - /../images/.

The problem is, I cannot define a link that works in Drupal. And I'm sure the images exist in that directory.

I've tried these-

<img src="<?php drupal_get_path('theme', 'eternal'); ?>/images/facebook_icon.png" alt="image comes here">

It just shows the alt text in every case. No image. How to accomplish this and what is the recommended and proper way to do this?


texts: It's possible to pass custom variables into Views?

texts:
It's possible to pass custom variables into Views ? I'm trying to manipulate some elements from a Views by using the administration page.

This how I ask the custom variable ...

custom_module.module

/**
 * Implements hook_menu().
 */
function custom_module_menu() {
    $items = array();
    $items['admin/structure/custom_module'] = array(
        'title' => 'Custom Module Integration',
        'description' => t('Custom Module'),
        'page callback' => 'drupal_get_form',
        'page arguments' => array('custom_module_form'),
        'access arguments' => array('administer  custom module configuration'),
        'file' => 'custom_module_form.inc',
    );
    return $items;
}

custom_module_form.inc

/**
 * custom_module
 */
function custom_module_form($form, &$form_state) {

    $form['custom_variable'] = array(
        '#type' => 'textfield',
        '#title' => t('custom_module configuration page'),
        '#default_value' => variable_get('custom_variable'),
        '#description' => t('Enter my variable'),
    );

    return(system_settings_form($form));

}

The variable is store in my Drupal variable_get which I can confirm on variable editor. So my goal is to be able to used custom_variable on Rewrite Results or Global: Custom text on Views. Which I have try it but does not translate to the variable value.

What I'm doing wrong ? Or is not possible to used variable on Views ?


texts: How to prolong time of displaying of images in carousel slideshow

texts:
I use Bootstrap 3-based Drupal 8 theme (Jethro). In the header, I have carousel of sliding images. They change every 5 seconds. I'd like to prolong this time to e.g. 30 seconds, so that every image is displayed for 30 seconds, not 5. So far I found only how to change speed of the change, animation, which is not the task. Any idea how to do it?

What I tried

In bootstrap.css and bootstrap.min.css:

.carousel-inner .item {
  ...
  transition: 30s ease-in-out left; # Increase time here
  } # Together with below it makes sliding slower, nothing more

and in bootstrap.js and bootstrap.min.js:

this.interval = 50000 // It does nothing
interval: 5000 * 10 // In Carousel.DEFAULTS; it makes sliding slower


texts: Can't create two separate row divs in a form

texts:
I am trying to have each case be in a specific row. The first row works correctly, however the second row absolutely does not. The field_suffix in the form is far to the left whereas I want it to the right. This appears to be because suffix isn't being put into the correct div ().

This is typically in a use case where first_name will be executed before last_name. What's going on? Why isn't this working?

  case 'first_name':
$form[$mapped_field] = array(
  '#type' => 'textfield',
  "#prefix" => "
",
);

$form['field_prefix'] = array(
  '#type' => 'select',
  '#title' => 'Prefix',
  '#options' => drupal_map_assoc(client_mod_prefix()),
  "#suffix" => "
",
  '#attributes' => array('class' => array('form-control')),
);
break;

  case 'last_name':
$form[$mapped_field] = array(
  '#type' => 'textfield',
  "#prefix" => "
",
);

$form['field_suffix'] = array(
  '#type' => 'select',
  '#title' => 'Suffix',
  '#options' => drupal_map_assoc(client_mod_suffix()),
  "#suffix" => "
",
  '#attributes' => array('class' => array('form-control')),
);
break;


texts: Fresh Drupal Install, UnmetDependenciesException

texts:
Has anyone ever ran into this, UnmetDependenciesException? From googling there is quite a bit of talk about this, but so far no concrete solution.

and at the bottom (you can't see it in the screenshot) it says

dependencies in Drupal\Core\Config\UnmetDependenciesException::create() (line 84 of core/lib/Drupal/Core/Config/UnmetDependenciesException.php).

Drupal\Core\Config\UnmetDependenciesException::create('standard', Array) (Line: 460)
Drupal\Core\Config\ConfigInstaller->checkConfigurationToInstall('module', 'standard') (Line: 132)
Drupal\Core\ProxyClass\Config\ConfigInstaller->checkConfigurationToInstall('module', 'standard') (Line: 141)
Drupal\Core\Extension\ModuleInstaller->install(Array, ) (Line: 83)
Drupal\Core\ProxyClass\Extension\ModuleInstaller->install(Array, ) (Line: 1571)
install_install_profile(Array) (Line: 661)
install_run_task(Array, Array) (Line: 539)
install_run_tasks(Array) (Line: 116)
install_drupal(Object) (Line: 44)

I got this when I did a fresh install of LAMP.

I do not get this error when installing Drupal 8 in another LAMP server that I setup a long time ago.

This leads me to believe that it could be some php extension missing or some other package, but according to the installer, it doesn't say that I am missing anything.

Suggested solutions that have not worked:

Using a different browser with all history & cookies cleared.
Made sure no Core files are missing, since I did a wget and then unzip. Even tried diff core versions.
Selecting Minimal install.


texts: Click on openlayers map and open a node form

texts:
I have an Opelayers map in a Drupal installation. I need to do 3 things:

  1) I would like to add a behaviour on the map so when someone is
  clicking on it the add node  form to appear and the geodata to be
  populated from the coordinates of the clicked point. So far I use draw
  event from behaviour but I cant trigger the form to open (in a
  colobox)

  2) I would like also the same to happen when I click on a link in
  pop-up (I have implemented a link there "add a node here")

  3) Is it possible to have a link of the views of the current location
  to the pop-up? Something like "see all nodes of current location");

Thanks in advance

I post a similar question here Dynamically change widget type in node edit form


texts: How to turn multi-value image field into a UL

texts: I have a multi-value image field.  I want to output the images in a UL/LI.  Should I add a prefix and suffix in preprocess_field?


texts: Create test and development copy of a production site

texts:
I have a Drupal8 site on my hosting account. I created a copy from the database;
I create a copy of the code.

Both the copies I used should be a copy of my production site. I imported the SQL into a new database. I changed the settings of the copied Drupal code to point to my new database.

When I go to the browser and look at local install I can only get to the install page.

Can anyone please point out where I am going wrong?


texts: How do you format the exposed filter options?

texts:
I am guessing this is a easy question, but I am stumped for a couple of hours.
I am using Views with some exposed filters as shown below.

Search keyword
Drawing Type
Type of Mould
Customer Name

They are all in one line where "Customer Name" and the "apply" button are wrapped onto the next line.
How do I make "Search keywords" in one line, then "Drawing Type" + "Type of Mould" + "Customer Name" on another line, and "Apply" button alone on the last line?


texts:
I've got a content type with fields whose values are URLs. I'd like to use a view to display these as links, using the field label as link name, something like {field_label}.

I've got the field values displaying correctly. I just can't figure out how to turn them into links like above (or if this is even possible).

How can I achieve this?


texts:
What I need to do is save a node and then add another node that uses some of the data in the saved node. I have figured out how to add another button onto the form that will save the node first and then do something else.

In my form alter I have added a second submit button to the original form:

   // Check for a particular content type's node form.
   if (($form_id == 'content_node_form')) {

   $form['actions']['submit_another'] = array(
   '#type' => 'submit',
   '#name' => 'save_another',
   '#value' => t('Save, and Add Another Submission.'),
   '#submit' => array('node_form_submit','create_partial_duplicate_handler'),
   '#weight' => 20,
   );

   }  //endif

It saves the node then, runs another function that will load some information from the just saved node into a new node.

Should the create_partial_duplicate_handler() function go to a menu item that calls another function or could I load the node form and the values directly in the function?

I have been reading lots of examples that create a menu item with a different url, but have not seen it done any other way. I don't want to waste time trying another method if the menu item method is the only way to do it.

Please let me know. Thanks.

ETA: I am using a second button because the user will have the choice of saving the node with the information entered into the form or saving the node and having another form appear with partial data from the saved node. The user enters the rest of the information into the partially filled form and again has the option of saving or saving and adding another.


texts: Drupal views custom template array issue

texts:
I have made a view named services which fetches the fields of content type services, fields name : services_text and services_image.
I have made a custom tpl named views-view--services.tpl.php with my own structure and want to access fields like $row['services_text'] in for each, but it comes out as undefined index, as i can figure it out, by using var_dump, that this tpl is not getting any row rather plain html string for output so I even tried with views-view-unformatted.tpl.php, but still no use.

Kindly help.


texts: I am using the advanced forum module and I was wondering how I can show breadcrumbs? I only want the breadcrumbs to appear only on the forum page


texts: How to print paragraphs in twig template?

texts:
I have a content type, basic, where i have added a Paragraph field field_pr that has two fields: field_text, field_color. I have a twig template node--basic--full.html.twig where I want to print the value of the paragraph field node.field_pr.

node.field_pr can have between one and ten paragraph values.

When I print the array for content.field_pr, I get a huge array. However, I only want the values from the field_pr.field_text and field_pr.field_color. How would I be able to do this from the node twig template?

I have tried the following but cannot seem to access the values. What am I missing?

{% for field in content.field_pr %}
   {{ field[loop.index0].entity.field_text.value }}
   {{ field[loop.index0].entity.field_color.value }}
{% endfor %}

{% for field in content.field_pr %}
   {{ field[loop.index0]['#paragraph'].field_text.value }}
   {{ field[loop.index0]['#paragraph'].field_color.value }}
{% endfor %}

Here is an image of the array that is printed for the node.field_pr field.


texts: Image title in Views replacement patterns?

texts: I can not seem to find the title token for images in replacement patterns in D8 views. In D7 it was [field_image-title] but there is no title option in D8. I have tried {{ field_image_title }} and {{ field_images-title }}.


texts:
I want to build a functionality on my website that allows you to +1 (add a vote) a post.
I want to integrate this functionality with facebook, so that 1 single vote is allowed per facebook user (without creating an account for that user on my site -- if it is possible).

Please point me in the right direction for this.
I'm looking for any solution that is a Drupal Best Practice, or any idea that you have on the subject and how it can be achieved.

Right now I think I will go with Fivestar module, but I'm not sure how to integrate this.


texts: How to add month and year dropdown to calendar month view

texts:
I want to add a month and a year dropdown to the month view of calendar so a user can jump to any month from the dropdown and can jump to the year, if selected. (Users can pick month OR year and will get results). I can add an exposed filter that doesn't update the calendar display when I click apply.

Any suggestions of what terms to search for or how to start this. I cannot seem to find tutorials or posts on this other than people saying yeah, I want that but I have no idea how to do it without building a custom calendar or using jquery datepicker.


texts: How to disable "Plain text" for a specific role?

texts:
I see that from admin/config/content/formats/plain_text I can not disable it for a individual role. How can I do this?

UPDATE:
I can change the attributes of the format and rename it, however I see no way to change the machine name of the format. It should be a better way to achieve this.


texts: Why doesn't variable_set() work in an installation profile?

texts:
I'm writing an installation profile, and I want to display some forms on some pages. The form below intended to set a variable at submission time. It does not work in the profile, but it works on an installed site. Why? Where is mistake?

function myprofile_install_mode_form() {
  $form = array();
  $form['myprofile_install_mode'] = array(
    '#type' => 'radios',
    '#title' => st('Please select'),
    '#default_value' => 0,
    '#description' => '',
    '#options' => array(st('Option 1'), st('Option 2')),
  );
  $form['actions'] = array('#type' => 'actions');
  $form['actions']['submit'] = array(
    '#type' => 'submit',
    '#value' => st('Continue'),
  );
  return $form;
}
// Submit handler
function myprofile_install_mode_form_submit(&$form, &$form_state) {
  $value = $form_state['values']['myprofile_install_mode'];
  variable_set('myprofile_install_mode', $value);
}


texts:
Is it possible to use a Page ID to target a specific page i.e.

function module_pageid_page_alter(&page){
}


texts: How to remove 'Main Menu' from my mobile view (using Superfish)?

texts:
I am using Bootstrap Business theme and I put Superfish module in my theme.

The problem is when it appears in Mobile View the title of "Main Menu" appear.

I would like to remove that title. However, I don't know how to make that.When click on the menu, it also involve that title.

Any suggestions?


texts:
I'm actually having a strange problem with one of my drupal installations. While I was trying to setup nginx for one of my sites, I ran into an issue that only the frontpage wont get cached.

After a bit of debugging, I found out that for some reason drupal always adds an session cookie to the HTTP response header (see screenshot)

This cookie is only added to the frontpage of my site, all other pages do not have it.
By adding this cookie, drupal prevents nginx to cache this site, cause I dont want users to be redirected to cached pages if they are logged in.

Someone have an idea where that cookie comes from? I checked other drupal installations,  but those don't have this cookie.


texts:
I have a view that shows an overview of "experiences".
The problem I am having is they switch HTML on every row.

so the first will be:

Image text

then the second will be:

Text Image

I tried using conditionals in the rewrite result.
But they seem to not work as shown below:

This outputs:

Is there a fix or workaround for this?


texts: Migrating a field collection with a field that has multiple values

texts:
I have a field collection migration that is taking nodes of type Map List from a D6 site which have two fields, a title, and a node reference to entity of type Venue.  There anywhere between 1-10 node reference fields on any given Map List.

The Map List nodes are to be migrated to a field collection on the D7 site called field_city_map_list which lives on the D7 nodes of type City.  On the D6 site the Map List nodes were referenced on the old City content type via entity reference fields.

With the query and sourceMigrations set I was able to get the field collections to be attached to the correct City node in the D7 site, however in the case where a Map List has multiple node reference fields, the migration creates a single field collection for each node reference.

So where field_city_map_list should have several lists, with multiple node references like this:

CityNode->
  Title: Some Title
  City Map Lists:
    Some List Title 1:
      345
      677
      987
    Some List Title 2:
      876
      678
      908
    Some List Title 3:
      493

It actually gets imported like this:

CityNode->
  Title: Some Title
  City Map Lists:
    Some List Title 1:
      345
    Some List Title 1:
      677
    Some List Title 1:
      987
    Some List Title 2:
      876
    Some List Title 2:
      678
    Some List Title 2:
      908
    Some List Title 3:
      493

I thought ordering the query by the map list nid and then by the delta in the field venue nid list would solve the issue but it didn't change the migration results at all.  There are no errors or migration messages that appear.

Here is my class:

class FCMapList extends myFieldCollectionMigration {
  public function __construct(array $arguments) {
    parent::__construct($arguments);

    $this->systemOfRecord = Migration::DESTINATION;

    $this->description = t('Field Collection: Map List Nodes');

    $dependencies = array(
      'VenueProfilePage',
      'City',
    );

    $this->dependencies = $dependencies;

    $query = Database::getConnection('default', 'legacy')
      ->select('content_type_map_list', 'ml')
      ->fields('ml', array('nid', 'field_link_title_value'));
    $query->join('content_field_venues', 'v', 'v.nid=ml.nid');
    $query->fields('v', array('nid', 'field_venues_nid'));
    $query->join('content_field_lists', 'l', 'l.field_lists_nid=ml.nid');
    $query->fields('l', array('nid'));
    $query->orderBy('ml.nid');
    $query->orderBy('v.delta', 'ASC');
    $query->isNotNull('v.field_venues_nid');

    $this->source = new MigrateSourceSQL($query);

    $this->destination = new MigrateDestinationFieldCollection('field_city_map_list', array('host_entity_type' => 'node'));

    $this->addFieldMapping('host_entity_id', 'l_nid')
         ->sourceMigration('City');
    $this->addFieldMapping('field_list_title', 'field_link_title_value');
    $this->addFieldMapping('field_venues', 'field_venues_nid')
         ->sourceMigration('VenueProfilePage');

    $source_key = array(
      'nid' => array(
        'type' => 'int',
        'description' => 'List content ID',
        'alias' => 'ml'
      )
    );

    $this->map = new MigrateSQLMap($this->machineName, $source_key, MigrateDestinationFieldCollection::getKeySchema());

     }
}

I had found a similar question that was self-answered however as I said above, ordering by source node nid and field delta did not solve the issue.

I'm on migrate version: 7.x-2.6-rc1+57-dev and field collection version: 7.x-1.0-beta7


texts: While we do some server maintenance, how might be prohibit our users from editing or adding content but not put the site in offline mode. That is, we'd like to have content browseable but temporarily prohibit content from changing.


texts: Programmatically created nodes don't appear unless opened and saved

texts:
I've written a simple script that iterates over a CSV file and creates nodes in Drupal. All of the nodes are present in the admin interface but do not appear on the site unless I manually click 'Edit' then immediately save. This is a real problem because I do not have time to open each and every node. Funny thing is, this doesnt happen for every node.

A simplified version of my code

 while (($data = fgetcsv($handle, 1000, ",")) !== FALSE) {
    $title = $data[1];
    $address1 = $data[2];
    $address2 = $data[3];

    // Add a node
    $node = new stdClass();
    $node->type = 'store_location';
    node_object_prepare($node);
    $node->status = 1; # published or not...
    $node->promote = 0;
    $node->uid = 1; // ID of author
    $node->created = date('U', strtotime('now'));

    $node->language = LANGUAGE_NONE;
    $node->path['pathauto'] = TRUE;
    $node->title = $title;
    $node->gsl_addressfield['und'][0]['thoroughfare'] = ucwords($address1);
    $node->gsl_addressfield['und'][0]['premise'] = ucwords($address2);

    node_save($node);
}


texts:
I'm currently working on a project on which I'm trying to dynamically shorten the pages titles as following:

"This is very long text blahblahblah | Site Name" becomes "This is very ... | Site Name" but the rendered page doesn't take this into account.

Here's my problem: I tried several hooks to implement this behaviour, using hook_menu_alter(), hook_preprocess_html(), hook_node_preprocess(), etc. and I followed the indications given to update the pages titles when using these hooks, but it always falls back to using the original long title.

Actually, when I set the arrays accurate keys/values, would it be $vars['head_title'], $vars['title'], etc. I can var_dump the array and verify the needed variable is updated, but the title is untouched. Using drupal_set_title($new_title) didn't help either.

I'm quite puzzled; would this be because I'm using Custom Field, Metatag, or a specific module? Or would this be because I'm not updating the page at the correct moment during its generation? Drupal is somehow new to me!

Thanks a lot :)

~Steph


texts: how to open desktop node link shared on facebook onto mobile device (mobile website version)

texts:
I have a desktop link:
mysite.com/node/22

When I share this link onto facebook, and try to open it on desktop prowser it's work good.

But when I try to open it (from facebook) onto mobile it's back me to webiste (mobile version) home.
mobi.mysite.com

how can i make it on mobile go to
mobi.mysite.com/node/22

I use (mobile switch) and (mobile tools) modules, and they are works good

thanks


texts: Auto URL Aliasing for Custom Menu Paths with Term Id

texts:
Here is my problem.

I have created a view with path as groups/% where % is a term id.
Now, i would like to create auto aliases for all groups/% with % as a term name.

Ideally i would like to add this alias path on creation of a term related to particular vocabulary. Is there any module that will do this out of the box ?

PATH AUTO MODULE: As far as i know it allows to set patterns only for taxonomy term paths and node paths for different content types.

But, how to set patterns for custom menu paths ?


texts: Rules sometimes don't convert saved node to nid

texts:
I have a strange problem with Rules. I try to set up 2-directional entity references. It works well with one content type, but fails with another. In the latter case, saved node is not converted into node when used as parameter in action like "Set data value" and Drupal tries to save it as array (which fails, of course).

So the questions is: Do you know about something (field, content type setting), which prevents Rules from properly converting saved object?

I'm using latest Rules dev from Drupal 7.

Rules export and error message can be found at https://gist.github.com/miloskroulik/898acaea40097724ff3e


texts: How to display nodes only after certain dates? (An Advent calendar is in progress)

texts:
I'd like to build an Advent calendar with Drupal 7 as a warm-up exercise.

What would be the recommended way to protect future calendar entries from being accessed before their time?

I have 3–5 different content types to be used as calendar entries.

Everything should be accessible to anonymous users as well, so I only need to check the current date.


texts: Change the number of entries depending on a theme setting

texts: I have a theme setting that allows the administrator users to specify how many teasers should be shown on the home page by selecting a number from 1 to 4 (through a <select> field). Is it possible to reference this variable so I can use it in Views? In that way, I can let Views check that value in the theme settings, then display the number of entries accordingly.


texts: Select users that do have certain roles and do not have others

texts:
I need some help with my SQL in that I want to get all users with a certain role that do have another role.

SELECT distinct users.uid, users.name, users.mail
FROM users AS users, users_roles AS ur
WHERE ur.uid = users.uid
AND ur.rid <> 4
AND ur.rid = 13

My SQL is really bad so any help would be appreciated.


texts: Insert a collapsible fieldset or region in a panels layout

texts:
I created a custom layout for a panels display and I would like to have a region or multiple regions in my custom layout be collapsible with javascript/jquery. Ideally the state of the collapible region would also be remembered by a cookie, but first thing is the collapsible functionality. Can anyone help?

<fieldset class="collapsible collapsed">
<legend>
Title of fieldset goes here.
</legend>
<p>
Content goes here.
</p>
</fieldset>


texts: Using hook_form_alter on an existing form element

texts:
I'm using the Commerce module and in the checkout process I'd like to change the size of one of the input fields. I'm trying to use the following code but it doesn't seem to be working.

Am I doing this correctly? Or is there a better way to change the size of an existing form input field?

function mytheme_form_alter(&$form, &$form_state, $form_id) {
    if ($form_id == 'form-AyTG_90yQduNFHHSAwpVnMfNNXEt5iv_eUvptp_Ex7E') {
        $form['edit-account-login-mail'] = array(
            '#size' => 40,
        );
    }
}


texts:
I haven't touched any default permissions for views in my site but they disappear for anonymous and authenticated users. In permissions 'view published content' is enabled for the mentioned roles. I have even tried rebuilding the permissions but no use.

I also checked permissions in views i.e, Access option in Block Settings and tried all combinations of it's options but still no use.

All other contents (shown through print render($page['content'])) are fine and displays upon logout but it's only the views that disppear.

I'm using Drupal 7.

I don't know what seems to be the problem, and what else to try.


texts: drupal 7: ajax functionalty does not work when displaying the node form in another page or in block?

texts:
I have created a content type. I then alter the form of that content type to display extra button to save node using ajax:
$form['submit'] = array(
  '#type' => 'submit',
  '#ajax' => array(
    'callback' => 'MyModuleName_node_add_callback',
    'wrapper' => $form_state['node']->type . '-node-form',
    'name' => 'submit1',
  ),
  '#value' => t('Submit Me'),
);

I then display the form for creating this content type in another page using this code
function MYMODULENAME_node_form($type){
  module_load_include('inc', 'node', 'node.pages');
  $form = node_add($type);
  return $form;
}

Now, the problem is that when i click on the button that i have created it shows me error this msg:

An AJAX HTTP error occurred.
HTTP Result Code: 500
Debugging information follows. Path: /path/system/ajax StatusText: Internal Server Error
ResponseText:

Can you please help me fixing this problem??
Thanks in advance
Mojo