texts: Programmatically set the block visibility

texts:
I set Configuration type to Block and selected my custom block to export the configuration from development/configuration/single/export. I got the following block visibility configuration.
visibility:
  _menu_position:
    id: _menu_position
    _menu_position:
      'main:menu_link_content:016650bb-ecd4-43e4-9d04-fef05ebcf186': 'main:menu_link_content:016650bb-ecd4-43e4-9d04-fef05ebcf186'
      'main:menu_link_content:2d195963-d98d-4f02-8129-6498c5db4b87': 'main:menu_link_content:2d195963-d98d-4f02-8129-6498c5db4b87'

For this, I have used the following function.
function placeBlock(EntityInterface $entity) {

    $config = \Drupal::configFactory();
    $settings = [
        'plugin' => '_block_module_block', // Set the plugin id
        'region' => 'header', // Set region to header
        'id' => $entity->id() . '-_bm_autoheader', // Use the page id and the module name for machine name
        'theme' => $config->get('system.theme')->get('default'),
        'label' => $entity->label(), // Use the page label
        'visibility' => [],
        'weight' => 0,
        'label_display' => 0, // disable label
        'page_id' => $entity->id(), // Reference page
    ];
    $values = [];
    foreach (['region', 'id', 'theme', 'plugin', 'weight', 'visibility'] as $key) {
        $values[$key] = $settings[$key];
        // Remove extra values that do not belong in the settings array.
        unset($settings[$key]);
    }

    foreach ($values['visibility'] as $id => $visibility) {
         $values['visibility'][$id]['id'] = $id;
    }

    $values['settings'] = $settings;
    $block = Block::create($values);
    $block->save();
}

In my case, $visibility gets a NULL value.
langcode: de
status: true
dependencies:
  module:
    - _block_module
  theme:
    - _drupal_theme
id: 57148-_bm_autoheader
theme: _drupal_theme
region: header
weight: 0
provider: null
plugin: _block_module_block
settings:
  id: _block_module_block
  label: 'Header Contact'
  provider: _block_module
  label_display: '0'
  page_id: '57148'
visibility: {  }

I need help to understand the block visibility setting. How does it work in Drupal 8? How can I programmatically set it?
Thanks in advance.


texts: Having trouble POSTing value for a select element with SimpleTest

texts:
I am trying to write a SimpleTest for a form that already exists. The form passes tests for GET, valid HTML and having the select element, which looks like this:

<select id="edit-buid" name="buid" class="form-select">
  <option value="1">New Business Unit</option>
</select>

The relevant code from my test case is:

$this->drupalGet('path/to/form');
$this->assertFieldByName('buid', NULL, 'form has buid field');

$edit = array(
  'buid' => 1,
);

$this->drupalPost('path/to/form', $edit, t('Save'));

I have tried passing the string "1" and array(1) and array("1") as well, but the test always fails with:

"Failed to set field buid to 1"

How can I make the test pass with the correct option selected?


texts: How to access the contents that are created by custom content type using module

texts: I am new to drupal, I wished to view the contents using custom modules. For that, I have created custom content type and added some contents. Now I want to create a module to display all the contents that are created by those content types, in a page. Contents should have title, image, description, date field. How can I do that.?


texts: Is there a more performant alternative than overriding template files?

texts:
I've got to get rid of a lot of unnecessary markup in a view. In general, I accomplish that by overriding the template files in my theme, but this time the view is really huge and performance is going down. So I wondered, if there's a more performant way to reduce markup? When altering the markup of a node, than preprocess functions are faster then overriding template files, is there an analogical mechanism for views?

Edit 1: Sure, the reason for the weak performance is not the overriding of template files on the first place, but if I can optimize a bit there, I'll have to do that. In addition I regularily get into trouble by disabling markup in views UI itself: disableing row-styles for example is ignored when I use an Omega subtheme …

Edit 2: I am aware of the possibilities inside the Views UI; What I am looking for is a manual way with fine control.


texts:
I'm using flags on my site as a way of filtering content through views, when a user views a certain node content type, I have a rule setup which resets the value of my flag and sets it against that user for that node, the views will reference this information and change their output accordingly.

The problem I have at the moment is what happens when anonymous users enter the site for the first time, they have no flag set, and thus none of the views show anything, until they travel to one of these special nodes.

What I'm looking for is: is it possible to set a flag to a default value, so that everyone has this node tagged until it gets changed?


texts: Webform template suggestion doesn't work

texts:
Is there a way to suggest a template in webform 3.x?

I have tried this:

$vars['theme_hook_suggestions'][] = 'webform__form__mywebform';

But it does not work.


texts: How can I change comment text to "DELETED" instead of actually deleting the comment?

texts:
I'm using threaded comments on my Drupal 7 site, and I'd like to be able to publicly preserve the fact that so-and-so commented here, and these were the replies. However, when a comment is deleted, all the replies are removed too. When a comment is deleted, I want the comment text to be changed to "DELETED" instead of actually deleting the comments.

I know about the un-publishing and hidden-comment kind of solutions, but I'd like the specific functionality I described instead of a workaround like those.


texts: display 2 tables with checkboxes by ajax button

texts:
I am altering a form and placing a new 'button' . On the press of the button, using the #ajax property , I want to display 2 separate tables with checkboxes for each row. Each table has separate data.

The 2 tables should be initially hidden and should become visible on button press. How should I proceed with this ??

The table data is fetched from database and some operations are performed on it.. so where should I put this code ? In the callback function ?

Update- I tried to implement this by using tableselect, but the checked boxes aren't returning the values in the $form_state['values']. You can check out the code here
 or suggest me a simpler interface to implement.


texts:
My doubts about drupal requirements are:
- Can run Drupal 7 on a Oracle WebLogic Server? How would the integration be?
- Can i use the Oracle driver for this porpuse?


texts: How can I limit anonymous users to viewing 3 nodes of a content type before signing up?

texts:
I have a content type that has a video link field (video is hosted off-site) and when you click the link it brings you to the video page full screen.  Are there any modules that will enable the ability to have an anonymous user only view a certain number of nodes of a given content type?

If not, what would be the best way to go about creating a module to do this?  Or is the scope of this module too heavy handed and I should look to limit the content type all together?


texts: Make a node field read only after the node has been created

texts:
I'm building a Drupal 8 module which will create several content types (with several fields) when the module is installed. The content types, field storages field instances, form displays & view displays are created with yml files in mymodule/config/install.

More details on the content types and fields:

Let there are two node types, A and B.
B has field called reference which is required, can have 1 value and the reference is to a node of type A. So basically B always has exactly one parent of type A.

What I want to do is to make the reference field read-only after the node is created.

In Drupal 7 I did this with Form API and hook_node_validate basically as follows:

I first checked if the form submission was for a new node or an existing node
If it was an existing node, I loaded the node (which is the node before the form submission at hand) and compared the value of the form submission to the value found on the actual node.
If the values were not the same, I returned an error.

Now, in Drupal 8 we have the Validation API which is really good thing because it kicks in with also other mechanisms than form submits. I'm only wondering how to implement the read-only locking described above.

Should I create a Constraint Plugin which would do similar loading of the previous version like I explained above and add that constraint with hook_entity_bundle_field_info_alter() or is there some other way?

Edit: Just to clarify, I'm interested to make the reference field non-editable on data level so that the value can't be changed even if updating the node programmatically. In other words, just making the field read-only on UI level on node edit form is not enough.


texts: How to include "children" content types on a content type page?

texts:
Let's say I override the way a content type page looks. My content type is Parent. So I create a page named: node--parent.tpl.php

But how about when you want to use nested content types?

Let's say:

Content Type Parent
Content Type Child

I use node--parent.tpl.php, but how do I display the children that belong to the parent? (linked using Contextual Filters).

For example in node--parent.tpl.php have a way to display:

Parent Name: Joe

Children: Sue, Phil, Mary and Jim


texts: How to have different URLs for microsites?

texts:
First of all, thanks for anyone bearing with me with this issue. I know that I really should start looking into how Apache settings work etc., but first of all, I would like to get this working. (Plus points for anyone recommending good Apache learning material, right? ;) )

I'm working on a Drupal 6 site running on Apache where several users (around 120) will have content which will act as a microsite. I have defined a content type for this purpose, used ThemeKey to switch to another theme only on those nodes etc.

I would like to be able to serve any of those nodes on a different domain (e.g. microsite.com) than the main site (e.g. mainsite.com). What should I do to "redirect" (sorry if I'm using any wrong terms here) the new domains to the right place? I would like to keep the new URL for the new pages (so it would not occur as mainsite.com/microsites/microsite, but microsite.com in the address bar).

[I've heard that it would be a bad idea to serve the same microsite with two different URLs from a SEO viewpoint - so that's another issue I should consider, but I have no idea on how I should address this...]


texts: Views Slideshow - Bullets or Numbered Pager not displaying

texts:
I have used Views Slideshow to generate a page slideshow. The rotation / cycle is working fine but I need to display a bulleted pager. Since I am not able to display any kind of pager, I started with trying to show a numbered pager first which is not working for me.

I have basically used this guide to setup numbered pagers.

However, I do not see the numbers after doing the same.

I have enabled the page controls and current page index for testing purpose. Below is what I get using Devel Themer module and the developer tools.

I just increased the height of the area which is supposed to display the pager so that I can click that area to show the themer information. I cannot see anything rendered in the div responsible for displaying the pager. Also, as I see in the template which is rendering the code for pager is simple.

From the file "views-slideshow-pager-fields.tpl.php" the code is the following.

<div id="<?php print $widget_id; ?>" class="<?php print $classes; ?>">
  <?php print $rendered_field_items; ?>
</div>

I do not understand why the pagers are not getting displayed. Where should I start looking for the fix?


texts:
I am new to configuring CKEditor on Drupal 7, and even with the UI, it has always been a pain. I am trying to have it to stop stripping / removing tags, specifically - code, pre, ins del, blockquote, q, dl, dd, dt. I have a test page which I use to test my site's styles and these are getting removed in both Full and Filtered. Grrrr...

Keep in mind I have no idea what I am doing here. Please help me figure this out so I do not waste another day on this. =(

ACF's extra allowed content

I have added the following there:

br; div; span; header; footer; section; aside; figure; a; img; strong; em; h1; h2; h3; h4; h5; h6; ins; del; cite; q; blockquote; code; pre; table; tr; td; th; thead; tfoot; caption; legend; col; ul; ol; li; dl; dd; dt;</code>

config.js

I have found config.js and added the following to get it to stop stripping out tags.

CKEDITOR.editorConfig = function( config )
{
// Define changes to default configuration here. For example:
// config.language = 'fr';
// config.uiColor = '#AADC6E';
config.allowedContent = 'br div span;' +
    'header footer section aside figure;' +
    'a[!href]; img[!src,alt,width,height];strong em h1 h2 h3 h4 h5 h6;' +
     'ins del cite q blockquote code pre;' +
     'table tr td th thead tfoot caption legend col;' +
     'ul ol li dl dd dt';
config.extraAllowedContent = ' br div(*) span(*);' +
    'header footer section aside figure;' +
    'a[!href]; img[!src,alt,width,height];strong em h1 h2 h3 h4 h5 h6;' +
    'ins del cite q blockquote code pre;' +
     'table tr td th thead tfoot caption legend col;' +
     'ul ol li dl dd dt';
};


texts:
how can i alter/inject a form in a specific content type. I'm developing a module (product list/shopping cart) to insert a form after the body of a specific content type but right now it's showing up in all the existing content types.

The module was not initially developed by me so i'm having a bit of trouble picking up from where it was left…

Here is the part i think is relevant:

function ftf_product_form_node_form_alter(&$form, $form_state) {

  $products = db_select('ftf_product')->fields(NULL, array('pid', 'nid', 'name', 'font_ref', 'description', 'app', 'web', 'desktop',  'avangate_desktop', 'avangate_web', 'avangate_app'))->condition('nid', $form['nid']['#value'], '=');
  $result = $products->execute();
  foreach ($result as $record) {
    $defaults[] = $record;
  }

  if(empty($form_state['num_products'])) {
    $results = $products->countQuery()->execute()->fetchField();
    $form_state['num_products'] = $results;

    if($form_state['num_products']  == 0) {
      $form_state['num_products'] = 1;
    }
  }

  $form['products'] = array(
    '#type' => 'fieldset',
    '#title' => t('Typeface products'),
    '#collapsible' => TRUE,
    '#collapsed' => (($defaults[$form_state['num_products']-1]->name && !$_SESSION["collapse_typeface_product"])?TRUE:FALSE),
    '#weight' => 5,
    '#tree' => TRUE,
    '#attributes' => array('class' => array('container-inline')),
    '#prefix' => '

&nbsp;
',
    '#suffix' => '

&nbsp;
',
    '#description' => t('
Create, edit and delete products here. To add or edit Typeface Price Factors please visit the admin section.

'),
  );


texts: Permisssions based on file folders & content collection

texts:
Can user permissions be customised based on file folders and content collections?

If so, what are the modules for this?


texts: Visibilities permissions of children links in the Toolbar

texts:
In a project started with the Thunder distribution, I'm currently managing the permission of the "editor" group.

By default, it only have access to the content menu, and it's a good thing.
But what if I want to give  permission to some children links (and only some specific children) of the others menu ?

Exemple:

I give to this group the ability to access, add, edit and delete some taxonomy terms.

I can access to the relative admin page, but the structure -> taxonomy link in the Admin Toolbar is not appearing.

For now I have to manually create those links, but I think it's not the right way to do this because they will constitute duplicate link for the "administrator" group.

I suppose I need to give visibility right for the parent link "structure", but how?


texts:
I can't show the main calendar as a page. What am I doing wrong?

I try to add to panel, but the finish button stops working in order to add it. Any idea?

I've added a snapshot:


texts:
Our Drupal site has recently started to get much more traffic and often pegs the CPU and memory when we have 50-100 active connections. We have 8cpus and 16GB of RAM. I notice that when the cpu is pegged mysql is by far the largest consumer so I decided to look at the mysql-slow.log and found that some queries take over 1 second and I am wondering if this is reasonable. Here is one example:

# Time: 150330 12:01:34
# User@Host: root[root] @ localhost []
# Query_time: 1.131631  Lock_time: 0.000301 Rows_sent: 4  Rows_examined: 151102
SET timestamp=1427738494;
SELECT
  node.nid AS nid,
  node.title AS node_title,
  users_node.name AS users_node_name,
  users_node.uid AS users_node_uid,
  votingapi_cache_node_points_projects_sum.value AS votingapi_cache_node_points_projects_sum_value,
  node.created AS node_created,
  node.changed AS node_changed,
  node_revision.timestamp AS node_revision_timestamp,
  'node' AS field_data_field_screenshot_node_entity_type
FROM node AS node
INNER JOIN users AS users_node
  ON node.uid = users_node.uid
LEFT JOIN votingapi_cache AS votingapi_cache_node_points_projects_sum
  ON node.nid = votingapi_cache_node_points_projects_sum.entity_id
  AND votingapi_cache_node_points_projects_sum.entity_type = 'node'
  AND votingapi_cache_node_points_projects_sum.value_type = 'points'
  AND votingapi_cache_node_points_projects_sum.tag = 'projects'
  AND votingapi_cache_node_points_projects_sum.function = 'sum'
LEFT JOIN votingapi_vote AS votingapi_vote_node_points_vote
  ON node.nid = votingapi_vote_node_points_vote.entity_id
  AND votingapi_vote_node_points_vote.entity_type = 'node'
  AND votingapi_vote_node_points_vote.value_type = 'points'
  AND votingapi_vote_node_points_vote.tag = 'vote'
LEFT JOIN node_revision AS node_revision
  ON node.vid = node_revision.vid
WHERE node.status = '1'
  AND node.type IN ('arcade_project_container')
  AND EXISTS (
    SELECT na.nid AS nid
    FROM node_access AS na
    WHERE na.gid = '0'
    AND na.realm = 'all'
    AND na.grant_view >= '1'
    AND node.nid = na.nid
  )
ORDER BY
  node_created DESC,
  node_changed DESC,
  node_revision_timestamp DESC
LIMIT 4 OFFSET 5800;

This query comes from the front page where I have a view which shows the most recent submissions. Should this query really take 1.13 seconds?

EDIT: Here is a screenshot of the results of running EXPLAIN on this query on phpmyadmin:

Here is the EXPLAIN after switch nid and uid as suggested by mikeytown2:


texts:
I am using the views Raw SQL plugin.

I have a simple raw SQL query where I want the result in a field to be a positive number otherwise 0 if it is a negative number:

This is what I have:

((votingapi_cache_node_polarity_sum.value / votingapi_cache_node_polarity_count.value) * 100)

How can I modify this query so that the result is a positive number only or 0.

The client wants this calculation:

Positive votes/total votes = voting score

using vote results from the positive - negative rate widget.
Its not an average a calculation of the voting score or average number of votes.


texts: Installed Revisioning Module, how do you make it default to create new revision?

texts:
I just installed the Revisioning module, but all my existing nodes are set to: "Modify current revision, no moderation", but I would like it to be set as create new revision by default. I don't want my users to manually click this when they are editing a node.

How do I make it by default to create a new revision for existing nodes?

Creating new nodes is not an issue as its already set by default to create a new revision.


texts: How to provide default panels pages via features, but allow overrides?

texts:
I'm working on a D7 distribution and I'd like to provide panels pages for some things like node views. I can do this with Features. But I also want the end user of the site to be able to modify the panels pages without the feature becoming overwritten.

I basically just want to install some "default" panels and if the user decides to override them, that's fine, I just don't want to revert their overrides the next time we do a features revert on the site.


texts: define custom jquery event to use in ajax form

texts:
How can I create custom jquery event to use in event:

$form['submitted']['subject']['#ajax'] = array(
  'callback' => 'suggest_ajax_callback',
  'effect' => 'fade',
  'event' => 'change',
);

for example I want execute suggest_ajax_callback each time user enter Space while filling text-field. so "How Can I Pay?" will cause 3 time execution...


texts: How to write a property callback for a custom field to use with the Entity module

texts:
I have a custom field with multiple values. I would like it to work with the Entity module. I need to create the correct property_callbacks in hook_field_info(). My field schema looks like this:

'ref' => array(
  'type' => 'varchar',
  'length' => 32,
  'not null' => TRUE,
),
'title' => array(
  'type' => 'varchar',
  'length' => 255,
  'not null' => TRUE,
  'default' => '',
),
'description' => array(
  'type' => 'text',
  'not null' => TRUE,
  'size' => 'big',
),
'weight' => array(
  'type' => 'int',
  'unsigned' => TRUE,
  'not null' => TRUE,
  'default' => 0,
),
'status' => array(
  'type' => 'int',
  'unsigned' => TRUE,
  'not null' => TRUE,
  'default' => 1,
),

Does anyone know how to actually do this? There is very little documentation around for it.


texts:
I have a list of images(nodes) displaying horizontally and I would like to start from a certain id in this list. The way I have it now it starts at most recent added image(node).

Is there a way to start at a specific id in views?

NOTES:  Would like it to look like the second image on page load. You can see in the first image there is white space to the left. I want this to be filled by an image. The navigation is fixed.


texts:
I want to use drupal 7 core module for contact.
I want to use it as block so that I can add a contact form to the right sidebar of your website which should be shown at every page. or render it anywhere in the page
I saw this on drupal site and tried to use it.

<?php
print drupal_get_form('contact_mail_page');
?>

It is showing me this

Warning: call_user_func_array() expects parameter 1 to be a valid callback, function 'contact_mail_page' not found or invalid function name in drupal_retrieve_form() (line 841

So any suggestion how I can use this.


texts: Architecture advice for site with lessons that belong to courses

texts:
I need to build out a site that features courses and lessons, each defined as a content type. I currently have the site running with lessons linked to courses using entity reference (entity reference field is in lessons) and use EVA to attach a view of lessons to each course. (see screen below for reference)

This works fine, however I now have a new requirement to allow lessons to be re-used across multiple courses. This means:

Courses can contain multiple lessons
Lessons can appear in more than one course
Lessons appear in "sections" which are custom per course
Lesson and section sort order is custom per course
Courses need to be able to handle up about 150 lessons per course

Since lessons need to appear in sections, the link requires both a reference and a section. I've experimented building this out with field collections embedded in the course entity. This works pretty well, but performance degrades significantly after about 30 lessons are added to a course.

To avoid the performance problem, another approach I'm considering is to code a compound field (entity reference with a text field) that would be added as an unlimited value field to the course content type.

Before I try the compound field approach, I'm seeking input/advice on the architecture for this solution. Given the requirements, and available D7 functionality, what approach makes most sense?


texts: Progress bar in drupal admin area for long running scripts

texts:
I have a custom module that has visual representation in admin area of my Drupal 7 installation.

Script that runs via that module executes pretty long time (some syncing process), and i would like to implement some kind of Progress bar (like when you run some cron job etc in Drupal, you see progress bar and even messages of the script parts).

How i can implement this ? Basicially, i would like to track a foreach loop, and iteration through foreach loop would be visible as progress bar.

Script is being triggered via hook_form_submit.

Thanks!


texts:
I am building an "Extranet" (Company Intranet, available both inside and outside our network).

What I want is three levels of authorization... Authorized (via LDAP AD), guest inside network and guest outside network.

Guest inside and Guest outside is where I'm getting hung up.

For users inside the network, I want "Public" stuff accessible (along with departmental stuff, depending on user signed in). For users outside the network I want a blank screen to show up until the user logs in (with proper AD credentials).

So a "Guest" inside the network should have access to stuff without logging in... a "guest" outside the network needs to log in before anything shows up.

I've seen some stuff that will "Ban" or "Whitelist" based on IP (since all the "inside" computers will be 192.168 or 10.10), but they don't seem to grant the ability to "greylist" (ban until logged in?).

I'm thinking maybe Themekey, with a separate theme for outside-unauthorized? Or would it be better to roll something up myself?


texts:
I want to add a comment form to my view by using the following code:

print drupal_get_form('comment_node_project_form', array('nid' => $node->nid), 'comment');

However, it shows up a error saying that the variable $node->nid is undefined. I then realized it is a view, not a node.

In the view, by choosing the right URL, e.g. /projects/{username}/{nodeid}, I only show one content.

I guess I can get the node ID by parsing the 3rd argument of the URL. How do I get the node ID from the view's URL?


texts: Access field data from entity in block plugin

texts:
I'm attempting to render certain fields within a block plugin but I'm not sure where to start as far as accessing the fields so I can render them.

I'm able to get the node ids after I perform the query using the following code.

    $query = \Drupal::entityQuery('node')
        ->condition('type', 'blog_post');
    $nids = $query->execute();

This retrieves the ids that I need based on the query but I don't know how to access custom fields like blog_summary.

I looked into some functions like getFieldDefinitions(). But I'm not sure how to make use of it. I attempted some things using getStorage but I assumed I wouldn't want to go that route since I'm not attempting to make any changes to the nodes I only want to access their fields.


texts: White blank page for 10 to 15 seconds then suddenly content appears

texts:
My site recently migrated to drupal 7 And it is already having a major page loading performance issues. Now very strange thing is happening to home page before showing accutual content it is  displaying a white blank page for 10 to 15 seconds and suddenly content appears. I dont know how to solve the issue. Did anybody face such problem before? plz  help

I have already implemented boost caches as well as memcache to speed up the pages


texts: Show facet filter even if there is no result

texts: Is there a way to show the facet filter, even if the Search API module returns no result?


texts: view inside a view with different arguments

texts:
I try to create a view with NID argument and embedd inside as a field another view with totally ditfferent argument. I used module called views_field_view but it seems that parent view is passing arguments to child view, which cause to break arguments on child view- that is what I do not want. Is it possible to do such combination? Thank you

What I try to do: I try for days to come up with some decent solution to this problem: On each node there is a multivalue field (field_ref) for referrencing 2 nodes (can be left empty as well). Also each node contains another field for (field_par) referrencing parent node. Moreover, each node has taxonomy term.
Now, on current node NID I need to display referenced nodes from field_ref. If the field is empty I need to display the values from the same field - but this time from a node that is referrenced in field_par on current node. If this field is empty, it should display values of the same field but from field_par of the parent node etc. until the node with top term is reached.
My solution was fairly simple - Argument - Content: Has taxonomy term ID (with depth) set to minus values so I get all terms all the way up. Add relationship to field_ref and connect it with fields - for example title. This way I get all results coming from parent nodes with higher taxonomy terms. Then I restrict results only to 2 results and add sorting according to custom integer field that I created on taxonomy terms according their depth (currently there is no other way to sort terms according to their depth) And that is it.
Problem with this solution is that I am not able to get inside current node values because adding another argument like NID breaks functionality of taxonomy argument.

I was also proposed another solution: to add NID as main argument and to get values from parent nodes using combined relationship : Content: Taxonomy terms on node + Taxonomy term: Parent term + Taxonomy term: Content with term. Which works ok but this view is static.

Finally what came to my mind was to combine view with my solution as a field inside a view with NID argument. So that the main view would display current node fields and if empty, it would display the field with embeded view refults. But maybe the solution can be much simpler and I am overcomplicating it:)


texts:
I am using the Drupal 7 Rules and Relation modules. I have a relation between a user entity and a node content type (membership). The relation has an added field (relationship type). I was able to define a rule to create a new relation entity and set the relationship type field when creating a new membership node.

Now I am trying to write a rule with a condition that checks the value of the relationship type field at the time some event referencing a user or membership entity fires. The Relation module provides actions to fetch endpoint entities, but I cannot find a way to fetch the relation entity itself. What I'm searching for is a way to load that relation entity, tell Rules the relation type to expect, then be able to access the field (relationship type) on that relation.

Thanks in advance for any advise.


texts:
I am working on a Drupal based site for a church and one of the items is a method for each group to have discussions.

I immediately thought OG would be a good fit but after consideration I'm not sure it will be enough by itself.

The goals are:

1.)  Users will be able to join a group or groups.

2.)  Each group will have private content for members only.

3.)  Each group will also have a mailing list for 2-way communication (so I don't believe SimpleNews will work).  Ideally, when a user is approved to join a group they will also be subscribed to that groups mailing list.

OG will be a good fit for the first 2 items.

I'm not sure about the third.

I've used Mailman in the past but it appears the mailman modules for Drupal are limited to Drupal 6.

What is the best way to achieve this in Drupal 7?


texts:
I would like to redirect my users to the login page on certain pages when they are not logged in. I have created a custom template for my login page, I don't know if that makes a difference, but I would like to pass two bits of information to the page in a way that the
user can't see them.

I would like to pass a message that should be displayed on the login page and also the URL that the user should be directed to after login. What is the easiest and most clean way of doing this please?


texts: How to have a Conditional Field in node form?

texts: My goal is to hide the field until certain value in another field is selected in the node edit form. Is there a way for achieve that?


texts: How to send e-mail to node author 1w before date field in node?

texts: I've got a content type with date fields. What I'd like to do is send a reminder e-mail to the post author one week before the value of the date field, with the rules module, or in another way. How would you go about this?


texts: Product Select List integration with Organic Groups member

texts:
I need help with this,I am trying to figure out what would be the best solution and if there could be an easier route. I am using Drupal commerce, plus OG, plus other modules. My question has to do with the product reference field. On a node ( I am using as a product), which reference an entity type product ( I am calling variant), on that node that has a product reference select list I want to filter the select lists items to only that groups related items. On the product entity type I created an entity reference field (called og_group_ref) which relates back to the parent group.

My question is how can I do this in code. I want to do something as follows. I am not great at coding but this is what I have come up so far.

// need to figure out the hook/s for this
function ????($id, $node) {
// Load the currently logged in user.
global $user;
$currentuser = $user;
// load current presaved node id -- that has not been saved
//node_save($node);

$node = node_load($nid);
// load the current presaved nodes = group id
$og_id = current($node->og_groups);

// check if the current node is a node of type product
if ($node->type == 'product') {
    // check if the current user is logged -- prob wont need these below
    //if ((user_is_logged_in()) && (in_array('brand owner', $user->roles))){
    //if (og_is_member('node', $og_id, 'user', $currentuser)){

     //Not sure how to how do this
     //programmatically loaded all referenced product entities (variant) of the product reference field (field_product_variation)
     //$my_entity = reset(entity_load('field_product_variation', array($id)));

      //Not sure how to how do this
     // Load all product entity of type(variant) of the current users group - filter it per that group. This entity type(variant) uses the entity reference field (og_group_ref) to reference to the parent group.
         $nids = array();
         $fields = variable_get('og_group_ref', array());
         if (isset($fields[$node->type])) {
        foreach ($fields[$node->type] as $field) {
             $query = new \EntityFieldQuery();
            $query->entityCondition('entity_type', 'node');
            $query->propertyCondition('status', 1);
            $query->fieldCondition($field, 'target_id', $node->nid);
            $result = $query->execute();
            $nids = isset($result['node']) ? array_merge(array_keys($result['node']), $nids) : $nids;
            }
          $nodes = (!empty($nids)) ? node_load_multiple($nids) : array();

        }
        // set the (field_product_variation) select list to the loaded list of current user's group's created products entity (variants)
        //Not sure how to how do this

        //  return the new list in the field_product_variation select list;
        }}}

}

This was originally referenced -- https://www.drupal.org/node/2569843#comment-10340927


texts:
I made my custom user-profile-edit.tpl.php using

function mytheme_theme($existing, $type, $theme, $path)
{

$hooks['user_profile_form'] = array(
                                // Forms always take the form argument.
                                'arguments' => array('form' => NULL),
                                'render element' => 'form',
                                'template' => 'templates/user-profile-edit',
                                );
return $hooks;
}

Now I want in user-profile-edit.tpl.php to render the account form (default Drupal form for users) and my profiles2 forms, from the forms i created without click the upper links.

Does anyone know how I can achieve this?


texts: How do I configure 'proximity to address' exposed view filter?

texts:
I have a view of nodes each with an address, and latitude/longitude. I've attached a Google Maps view block which displays the pins on the map corresponding to the results in the list.

I'm using geocoder to convert address module addresses to a lat/long field on node save, and geolocation for the map and proximity search. I can use lat/long and distance for proximity search, but I'd like the users to enter an address and see the results sorted by distance.

It seems like all the functionality is in place, it just needs wiring together. How can I set up an exposed filter to accept an address, maybe convert it to lat/long behind the scenes, and use a very large default distance to display the results by proximity?


texts: In Configuration > Development > Performance, in the Caching area, [Cache pages for anonymous users] and [Cache blocks] are unchecked. When I check them and save, the page reloads and both boxes are again unchecked. Is this wrong? Shouldn't they "remember" the state?


texts: Get current user password before it is overwritten in user form?

texts:
I know this is probably unlikely, but I am doing the diligence anyway.

Is there any way to get the current user password from Drupal before updating it with a new one on the user form (user editing account info)?

When it is updated, I would like to trigger an API call to a remote system and update the account password there, too (authentication happens on an external system). However, the API call requires the old password as well as the new one before it will update it.

Otherwise, I need to lock off any way of updating a password in Drupal from privileged users.


texts: How can I get hold of the Composer object?

texts:
I'm trying to get the file location of something in an installed package.
https://stackoverflow.com/questions/15714809/get-filesystem-path-of-installed-composer-package says I can get that from the Composer object.
But in Drupal, how do I get the Composer object?


texts: dreamhost VPS returns a lot of blank pages

texts:
After upgraded from shared hosting to VPS (for more memory), my site returns a lot of blank pages, for example:

plain /update.php is OK, but returns blank page after clicking Continue and Update
plain /admin/reports/status is ok, but /admin/reports/updates/check?destination=admin%2Freports%2Fstatus returns blank space

php memory_limit is now 512M.

Any dreamhost user shares some experience?


texts:
I have googled and read many posts on entity reference, taxonomy etc...

Here is the problem:

I have a procedures entity and sequences. Procedures can have any number of sequences. The same sequence may belong to many procedures.

The key difference for me is I need the order of the sequences to be specific per procedure.

I assume a custom taxonomy with an 'offset' field added would be sufficient to address this requirement?

Suggestions?


texts: Change text in popup exposed date filter

texts:
I have an exposed popup date filter that selects by day. When a user sees it, it looks has this text: May 28 2016.

Would I be able to edit it so that it would look like "May 28th, 2016"?
I am using drupal 7.23 and Views 3.13.

Thanks in advance!


texts:
Use case: I've created a custom content type with a variety of fields and widgets.

I want some privaledged users to be able to edit these nodes, but not get distracted by several fields they will not need.

So to provide a slimmer version of the edit mode...is it something I should do with Views, or perhaps create a custom tpl file?


texts: define a template file for a field item in my modules

texts:
I wish to register a template file for use with a filed item, but I can't wrap my head around it.

here is what I am trying to achieve.
In my field widget Formatter

public function viewElements(FieldItemListInterface $items, $langcode) {
$elements = [];

foreach ($items as $delta => $item) {
  $elements[$delta] = [
    '#markup' => $this->viewValue($item),
    '#theme' => 'my-field-item-template',
  ];
}

return $elements;

}

Then in my .module file

function mymodule_theme($existing, $type, $theme, $path){
return array('myplugin' =>
    array(
        'variables' => array(
            'other elements' => 'other elements',
            ),
            'template' => 'my-field-item-template'
        )
    );

}

I wish to print my 'variables' in my twig file, I believe my template file is not registered for use with my field item this way. What's the right way?


texts: What filename do you use to theme the node edit page in Drupal 7?


texts: how to get the nid into a views table div?

texts:
Possible Duplicate:
  Dynamically adding a CSS class to a view row with template.php

I would like to have the node nid to be used in the DIVs of a views based table layout. When I use "style settings" / "customize field HTML" css class "divname[nid]" it has no effect (yes, I had nid added as the first field in the view ...).

What I'm trying to do is hide a div and a link in that table row when I click on links in the same table row. See my previous questions here and here.


texts: Adjusting Apache Solr bias based on content length?

texts:
I have a site using the Apache Solr Search Integration module with a short-form content type that is getting weighted too highly in the Solr index. I've tried adding "Bias" to the other content types and leaving the short-form content type set to Ignore, but even with other bias settings maximized the short pieces still rise to the top. Looking at the particular items that appear at the top, it seems to be that multiple instances of the search terms in a short piece cause it to rank higher.

According to the help on the bias settings page, "Any value except Ignore will increase the score of the given type in search results." Is that a limitation of the Solr module or of Solr itself? Ideally, I'd like to decrease the relevance of the short type. What are my options for doing that?


texts: Selected terms to be used in content type twice

texts:
I want to create a content type with two steps using MultiStep

First Step - Select names(Taxonomy) From Multiselect

Second Step  -Now I want to display the selected name on a Multiselect

How to achieve this?? I haven't tried anything because i have no idea on how to do it.


texts: Custom module javascript Drupal.behaviours doesn't seems to load

texts:
I have a custom module which has a javascript file.  Here's the content of the javascript file:

(function ($, Drupal) {
    Drupal.behaviors.promotionalOverlayBlock = {
        attach: function(context, settings) {
            console.log("hello world")
        }
    };
})(jQuery, Drupal);

The location of javascript file:

mymodule/js/overlayblock.js

In my mymodule.libraries.yml file it has the following:

mymodule:
  js:
    js/overlayblock.js: {}
  dependencies:
    - core/jquery
    - core/jquery.once
    - core/drupalSettings

When I load my drupal page, I expecting to see the "hello world" in the browser console.  However, nothing show up.  I view the page html code and search for my javascript there, but I can't seems to find anything related to my javascript file.

What could be the problem here?

Here's how I attached my library through the hook_preprocess_block() I'm not sure if this is the right place to add the attached.

function mymodule_preprocess_block(&variables){
  $variables['#attached']['library'][] =
  'mymodule/overlayblock';
}


texts:
I have a view that sorts by a taxonomy term. After the view layout, i need to find a specific way to have that page that's clicked on to be styled with a different background. For instance, this view will show a background of a Football, but I also have a view for other sports. Is there a way to determine the page name? Right now, its just a node-page-profile.  Here's the link.

http://dev-httpwwwrestechsyscom.pantheon.io/profiles-football


texts: How to make dynamic google map in block?

texts:
I want to make block with two links that lead to different gmaps position. Also gmaps is in that block.
So, block haves address text with two location and by clicking on that location i want that gmaps change the position of marker without reloading all page. So it is need to be dynamic block. Any help?


texts: Content type with multiple different flavours

texts:
I want to create content type (document) with title, comment and file attachment (PDF or doc). I don't want to create different content types (for each document type form, policy, abuse etc..) because if i need to add/remove/change field in it it's need to be repeated on all content types. I'm thinking about taxonomy but I'm not sure.

What's the best solution for one content type with multiple different "flavours"?


texts: Menu access callback function called multiple times

texts:
I have following menu defined with access callback function. As You can see this is a hack so I can use REST via GET ( normally Services do not offer this ).

All my endpoints are defined /rest/api/[endpoint] this is a /config one:

function MYMODULE_menu() {
    $menus['rest/api/config'] = array(
        'title' => 'Configuration',
        'page callback' => 'MYMODULE_config',
        'access callback' => 'MYMODULE_access_callback_basic_auth',
        'type' => MENU_CALLBACK,
    );
    return $menus;
}

The issue is that the MYMODULE_access_callback_basic_auth is called 5-times for every request.

Can You help me why this happens ?


texts: Block is displayed on page even though no region is selected, how is this possible?

texts:
I am fairly new to drupal, while doing some maintenance I came across a situation that I don't understand

A block, which is defined inside a view has no region selected, yet it appears on pages determined by the "Only the listed pages" option below

It appears in a specific region, an <aside> named as "region-sidebar-second"

I'm unable to find anywhere in admin, or in the code to determine that is the region where this block should appear.

What could I be missing?


texts: Is it currently possible to install Drush locally on a Windows 10 PC?

texts:
Is it possible to install & use Drush locally on a Windows 10 Notebook to manage Drupal sites (on shared hosting) online?
I have so far searched in vain, may be in wrong places. The places I see downloads or documentation, none seems to include Windows or in case of some tutorial on Youtube, the links related to drush on drush.org, do not seem to exist any more, such as that for "composer for Windows".

I would appreciate some specific guidance as a newbie on this.

Thank you & kind regards


texts: Hide/disable EDIT & DELETE links in menu-customize form

texts:
How to hide/disable EDIT & DELETE links in menu-customize form.

www.yoursite.com/admin/build/menu-customize/primary-links

I think that those links bring more potential problems than benefits. It would be great if anyone knew how to disable them per role but a global disable is fine too. I'm using Drupal 6.

p.s. I still want user to have permission to rearrange menu items ordering.

Thanks for the help.


texts: Enabling XML under PHP in windows - import_html module not working

texts:
So I'm having a problem with import_html. Basically, when I run the import from the sight, all of the content I wanted (except for xml files) get imported but I get these errors and warnings repeatedly:

Warning: DOMDocument::loadXML(): Opening and ending tag mismatch: link line 7 and head in Entity, line: 9 in parse_in_xml_string() (line 159 of
C:\Bitnami\drupal\apps\drupal\htdocs\sites\all\modules\import_html\coders_php_library\xml-transform.inc).

User warning: Failed to cleanup namespaces and end up with a valid XML file in import_html_cleanup_namespaces() (line 1693 of
C:\Bitnami\drupal\apps\drupal\htdocs\sites\all\modules\import_html\import_html_process.inc).

Notice: Trying to get property of non-object in import_html_process_html_page() (line 875 of
C:\Bitnami\drupal\apps\drupal\htdocs\sites\all\modules\import_html\import_html_process.inc).

Warning: XSLTProcessor::transformToXml() expects parameter 1 to be object, boolean given in xmldoc_plus_xsldoc() (line 211 of
C:\Bitnami\drupal\apps\drupal\htdocs\sites\all\modules\import_html\coders_php_library\xml-transform.inc).

User warning: Nothing useful extracted via XML from that content in import_html_process_html_page() (line 903 of
C:\Bitnami\drupal\apps\drupal\htdocs\sites\all\modules\import_html\import_html_process.inc).

Notice: Undefined variable: tid in import_html_indexes_import_html() (line 27 of
C:\Bitnami\drupal\apps\drupal\htdocs\sites\all\modules\import_html\extras\import_html_indexes\import_html_indexes.module).

Notice: Undefined property: stdClass::$title in node_import_html() (line 81 of
C:\Bitnami\drupal\apps\drupal\htdocs\sites\all\modules\import_html\modules\core.inc).

Notice: Undefined property: stdClass::$import_html_create_menus in menu_import_html_after_save() (line 159 of
C:\Bitnami\drupal\apps\drupal\htdocs\sites\all\modules\import_html\modules\core.inc).

Deprecated function: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in charset_decode_utf_8() (line 2051 of
C:\Bitnami\drupal\apps\drupal\htdocs\sites\all\modules\import_html\import_html_process.inc).

When I run drush import-html,nothing gets imported and I get:

import_html found no XSL library support at all on this server! Need   [warning]
the PHP 'xsl' extension enabled in php.ini xml-transform.inc:31
Sorry, with no XML support there will be no content scanning AT ALL.     [error]
Aborting process. See the import_html_help.htm for info on enabling
XML under PHP. import_html_process.inc:724
WD Import HTML: Failed to process any node out of file                   [error]
'8ab24e480a68476f800648582eaabf43.html'
WD Import HTML:                                                          [error]
Failed to get any results from the attempted analysis of
8ab24e480a68476f800648582eaabf43.html.
The source file path was probably unavailable or not HTML.
WD Import HTML: No results! Failed to extract any new nodes            [warning]
Processing 1 files for import. Using default configuration settings.    [status]

Because I have a windows computer, I followed these directions for enabling xsl in php, and when I did so, I was able to get regular html files imported via the website import-html. But why am I getting these other errors?


texts: How to create a simple Drupal module that updates a custom node field

texts:
I have a custom node type "product" which has a custom Decimal type field "field_price".

I would like to create a simple module in Drupal 8 to set this value to 10.75 every time I create or update a node.

edit

I have now restructured the module as follows. These are the files / folder structure I have (excluding the .info.yml) :

Module folder:
/modules/updateprices

Routing.yml:
/modules/updateprices/update_prices.routing.yml

Routing.yml code:
update_prices:
    path: /updateprices
    defaults:
        _controller: 'Drupal\updateprices\Controller\UpdatePricesController::update_prices_node_presave'
    requirements:
        _permission: 'access content'

Controller code:
/modules/updateprices/src/Controller/UpdatePricesController.php

<?php
namespace Drupal\updateprices\Controller;
use Drupal\Core\Entity\EntityInterface;

class UpdatePricesController  {
        function update_prices_node_presave(EntityInterface $entity) {

          $entity_type = 'node';
          $bundles = ['product'];

          $fld_price = 'field_price';
          if ($entity->getEntityTypeId() != $entity_type || !in_array($entity->bundle(), $bundles)) {
            return;
          }
             $entity->{$fld_price}->setValue(10.75);
        }
}

I am now getting an error:

  ReflectionException: Class
  Drupal\updateprices\Controller\UpdatePricesController does not
  exist in ReflectionMethod->__construct() (line 123 of
  /home/website.com/core/lib/Drupal/Core/Entity/EntityResolverManager.php).


texts: Error in drupal "Notice: Undefined index: extension in require()..."

texts:
I am seeing this error on my page

  Notice: Undefined index: extension in require() (line 207 of
  /home/....../public_html/includes/filetransfer/sftp.inc).

I have no idea from where. I tried doing search but I did not see any help.
Could you please guide why this message is poping up on all the pages.


texts:
i am using this hook in my custom module but getting a fatal error

  Fatal error: Cannot use object of type stdClass as array in
  C:\wamp\www\bid\includes\common.inc on line 5901

Anyone can help???

Below is my code, I have two conditions in it. In the second condition I want to search with taxonomy index because I have added a filter contains taxonomy parent term.

/**
 * Implements hook_search_execute
 * Override core node_search_execute here with custom implementation
 * Basically a clone of node_search_execute, but with limit variable available
 * See mymodule_module_implements_alter
 */
   function mymodule_search_execute($keys = NULL, $conditions = NULL) {
 // Add new limit conf variable
   $limit = variable_get('search_result_limit', 10);
 // Build matching conditions
  $prnt = (isset($_REQUEST['prnt'])) ? $_REQUEST['prnt'] : 'none';
  $site = (isset($_REQUEST['chld'])) ? $_REQUEST['chld'] : 'none';

  $query = db_select('search_index', 'i', array('target' => 'slave'))->extend('SearchQuery')->extend('PagerDefault');
    if (($prnt != 'none' && $site!= 'none') || ($prnt = 'none' && $site!= 'none')) {

        $query->leftjoin('node', 'n', 'n.nid = i.sid');
        $query->leftjoin('field_data_field_category', 'fdfc', ' fdfc.entity_id = i.sid ');
        $query->leftjoin('taxonomy_term_data', 'txd', 'txd.tid = fdfc.field_category_tid');
        $query->condition('txd.name', $site, '=');
    }

    if ($prnt != 'none' && $site = 'none') {

        $query= db_select('taxonomy_index', 'ti');
        $query->leftjoin('node', 'n', 'n.nid = ti.nid');
        $query->leftjoin('taxonomy_term_data', 'txd', 'txd.tid = ti.tid');
        $query->leftjoin('taxonomy_term_hierarchy', 'tth', 'tth.tid=txd.tid');
        $query->condition('tth.parent', '$prnt', '=');

    }

   $query->join('node', 'n', 'n.nid = i.sid');
   $query
         ->condition('n.status', 1)
         ->addTag('node_access')
         ->searchExpression($keys, 'node');

   // Insert special keywords.
   $query->setOption('type', 'n.type');
   $query->setOption('language', 'n.language');
   if ($query->setOption('term', 'ti.tid')) {
   $query->join('taxonomy_index', 'ti', 'n.nid = ti.nid');
 }
  // Only continue if the first pass query matches.
 if (!$query->executeFirstPass()) {
  return array();
  }

 // Add the ranking expressions.
  _node_rankings($query);

// Load results, use limit variable
  $find = $query
   ->limit($limit)
   ->execute();
 $results = array();
 foreach ($find as $item) {
  // Render the node.
  $node = node_load($item->sid);
  $build = node_view($node, 'search_result');
  unset($build['#theme']);
  $node->rendered = drupal_render($build);

  // Fetch comments for snippet.
  $node->rendered .= ' ' . module_invoke('comment', 'node_update_index', $node);

  $extra = module_invoke_all('node_search_result', $node);

   $uri = entity_uri('node', $node);
   $results[] = array(
  'link' => url($uri['path'], array_merge($uri['options'], array('absolute' => TRUE))),
  'type' => check_plain(node_type_get_name($node)),
  'title' => $node->title,
  'user' => theme('username', array('account' => $node)),
  'date' => $node->changed,
  'node' => $node,
  'extra' => $extra,
  'score' => $item->calculated_score,
  'snippet' => search_excerpt($keys, $node->rendered),
  'language' => entity_language('node', $node),
 );
}
  return $results;
}


texts: How not show in a View certain taxonomy items if there are no associated nodes?

texts:
I'm using a View to display all the items from a taxonomy term list I've setup. The taxonomy term is used as a field in my nodes. That's all fine.

Now, I created another view called 'all categories' that displays all the taxonomy terms (each term is only displayed once). When a user clicks the term they automatically go to the term page and see the nodes that are using that term.

The problem is that some of the terms haven't yet been used by any nodes so when the user clicks the term name for those it just takes them to a page that says [name] at the top with no other information. I'd rather just hide any categories that have no associated nodes, but I don't know how to do it. I'd also be open to other suggestions for alleviating this issue.

Note: if a term DOES have nodes associated with it and you click the term it takes you to a page with the term as the title and the associated nodes listed below the title.

Here's the settings I have for the 'All categories' view:

Show: Fields
Fields: Taxonomy term: Name (link this field to its taxonomy term page)
Filter Criteria: Taxonomy vocabulary: Machine name (=Category)


texts: User profile layout vs. contact form option

texts:
On the user profile I have some 12 fields for the users to enter their contact information and other details about themselves. The option to activate/deactivate the personal contact form is somwhere between the fouth and the fith field.

I would like to have to personal contact form option to be on a position I intend it to be on – e.g. the first position, before all other fields, since it's an option – and not a field. Disabling the drag'n'drop i can actually rearrange the fields in the intended order. But when I switch drag'n'drop field sorting back on, the checkbox jumps back down somewhere between field four and five.

Any suggestions anybody?
Thanks!!


texts:
Any pointers gratefully received!

For Drupal 8.

I'm looking to use the image select webform element - but instead of the options being added when the webform element is created/edited we need to get the options from a content type.  This is partly because we need to have extra fields available to output from the content (so JS can show/hide) - but also the editors want to be able to control when various options are available - by using 'show after' dates etc.

So - we have a content type - called vehicle - with an image field and a car group field and a 'show after' date.  Ideally I'd like them to display in the same way as the current 'image select' webform element.  But any way of outputting the list of vehicles as options for a webform field would be great.  And I'm happy to output all the vehicles as there are not very many and the list will be further cut back by Javascript.

Thanks again!


texts: How to use webform submission data in a Rules Condition?

texts:
I want to send an email when a user fills in a webform, but only if it is our review form and if the user gave the feedback higher than a 7.

So we are asking how good we are, and the user gives us a value from 1 - 10, we want to send an email if that number is higher than 7.

Basically, I have installed the Rules and the Webform_rules modules.
Now I can make a rule with an action: 'After a form has been submitted'

Next I made the nid equal to the nid of the specific webform.
And then I want make a second condition to compare the filled out value the be 7, 8, 9, or 10, so I make an data comparison condition.
With the condition 'data' and the field name like: 'data:grade-value-raw' it just tells me there is no grade-value-raw

If I set the reaction to display the [data:grade-value-raw] on the page, it works.

Why can't I use it in the Rules Condition?


texts: How to make submit button work in form themes

texts:
I am trying to create a form which calls an external template file to format the form but ended up into a typical issue. This is what I was doing. I created a hook menu and called a theme, in the theme declared the template, and in template called the form elements and rendered along with html code. Everything is working fine except the submit button. If I render form directly, submit is working, or if I use drupal_get_form in menu page callback, it works (again template is not getting applied). I'm confused what am I doing wrong. I am a newbie so excuse me if this is a repetitive or stupid question.

Here is my code.
My module file named agents.module

<?php
function agents_menu(){
  $items=array();

  $items['myform']=array(
    'title'=>'Form',
    'description'=>'Submit Form into database',
    'page callback'=>'agents_form',
    'access callback'=>TRUE,
    'access arguments'=>array('access content'),
    'type'=>MENU_CALLBACK,
  );

  return $items;
}

function agents_form(){
  return theme('students');
}

function agents_theme(){
  return array(
    'students' => array(
        'render element' => 'form',
        'template' => 'customTemplate',
    ),
  );
}

function students_form($form, &$form_state){
  $form = array();
  $form['efname'] = array(
    '#type' => 'textfield',
    '#title' => 'First Name',
    '#size' => 28,
    '#maxlength' => 10,
    '#required' => TRUE,
  );

  $form['elname'] = array(
    '#type' => 'textfield',
    '#title' => 'Last Name',
    '#size' => 28,
    '#maxlength' => 10,
    '#required' => TRUE,
  );
  $form['submit_btn'] = array(
    '#type'=>'submit',
    '#value'=>'Submit',
    '#submit' => 'agents_myForm_submit'
  );
  return $form;
}

function students_form_validate($form, &$form_state){
  dpm($form_state['ename']);
}

function students_form_submit(){
  dpm('into submit');
}

and my customTemplate.tpl.php code looks like this

<?php
  dpm(drupal_get_form('students_form'));
  $form = drupal_get_form('students_form');
?>

  <?php print render($form['efname']); ?>
  <?php print render($form['elname']); ?>

  <?php print render($form['submit_btn']); ?>

<?php
  dpm(render($form['form_build_id']));
  print render($form['form_build_id']);
  print render($form['form_token']);
  print render($form['form_id']);
?>
<?php print drupal_render_children($form);

I am a newbie to drupal, and I was not able to figure out what am I doing wrong. If I directly render the form without rendering submit individually, (i.e. print render($form) ) it works fine. It would be a great savior of the day if someone helps me cross this hurdle.


texts: Undefined index $base_path in include(), line 7 of page--front.tpl.php

texts:
I receive this error message in my pages; strange enough, it doesn't appear in the front page.

  Notice: Undefined index: $base_path in include() (line 7 of /home/kinderen/kinderenenislam.nl/sites/all/themes/kei2/page--front.tpl.php).

Where should I include $base_path?


texts: overriding submit functions with content types

texts:
I have created some content types, some are created programmatically, others (including the one I am interested in are where created using the front end GUI.

And this is where my issue starts, I would like to format some of the text that is returned on the form submit.

And to be honest i am unsure how to do this.

in this example I have created a custom content type called 'show_date'

I would think that when the subnit function is caled I can pass the data to a custom fucntion, I would imagine this to being called show_date_submit thus:

function show_date_submit(&$form, &$form_state)
{
    /*
     my custom code would go here
    */

}

Is this right? any help given is as always appreciated and given Thanks for.

Al the best,

Jim


texts: Figuring out a conditional statement for a specific page

texts:
I have a view which is modified by a views template page - this is in Drupal 6.

I'm trying to figure out a condition to affect the layout. Currently, the  element seems to be generated in page.tpl.php, which is fine, but I want to add a condition for this specific page, in order to add an id to this element.

For other pages, I've used the node id to do this, as such:

else if ($node->nid == '250' || $node->nid == '429' || $node->nid == '555' || $node->nid == '378') {print '<h1'. ($tabs ? ' class="with-tabs"' : '') .' id="medspecheader">'. $title .'</h1>';}

But I'm not sure how to do this with the view page. Is there a machine name that I can use, or something to affect the layout?


texts:
I am not particularly new to programming, but trying to theme how Drupal 7 outputs entity fields is giving me headaches. I think Drupal is great, but the documentation could be more organized and complete. I have sifted through a lot of material about this, but I'm still struggling to organize the bits and pieces of information into usable representation of how Drupal 7 treats and outputs field values.

This is an example output that one would like to obtain:

#field value#
                      // Suppose this is the node title

#field value#
       // Sub-title

                              // Attributes:

                        #field title#:

                        #field value#

                        #field title#:

                        #field value#

                        #field title#:

                        #field value#

                        #field title#:

                        #field value#    // e.g. Link to Taxonomy term page

#field title# and #field value#, represent where one would like Drupal to output the field titles and/or values submitted when creating entities/nodes.

The idea sounds straight-forward, but I find it to be immensely complicated in practice.

Some pitfalls I have encountered: Drupal makes presumptions, on how the field should be displayed, it gives it additional markup, which I have been unlucky in managing. When outputting through Panels the UI does not provide ways to separate field value and title. Am I under correct impression that I need separate template files or functions for all fields if I want the above structure?

Please shine some light on the matter. I bet many people would love to hear how more experienced developers approach these problems.


texts:
I've created a Drupal 8 module that adds a custom plugin to the core's CKEditor. This plugin allows users to add tabbed content to their pages.

The problem is that the plugin adds a class to the  element it creates and CKEditor by default removes classes from most elements once you save the node.

I can change CKEditor config for Basic HTML editor (admin/config/content/formats/manage/basic_html) to allow classes in  elements by changing  to  in "Allowed HTML tags" input.

Now I would love to be able to do this programmatically somehow. How can I change the configuration for CKEditor in a Drupal module? Especially the "extraAllowedContent" config value.

The project for reference purposes can be found at https://github.com/j-vee/ckeditor_tabber


texts:
Somehow I am not able to write a query for filtering a view.

I don't understand why the below script is not working:

function xxx_views_query_alter(ViewExecutable $view, QueryPluginBase $query){
    $node = \Drupal::request()->attributes->get('node');
    if($node){
        if($node->getType() === "article"){
            $release_date = $node->get('field_release_date')->value;
            if($release_date){
                $date = new DateTime($release_date, new DateTimeZone(Drupal::config('system.date')->get('timezone')['default']));
                $value = sprintf('%d', $date->getTimestamp() + $date->getOffset());
                $query->addWhereExpression(0, "node__field_release_date.field_release_date_value > 1503944085");
                kint($value);
                //$query->addWhereExpression($this->options['group'], "$field $this->operator $value");
            }
        }
    }
}

It seems that

 $query->addWhereExpression('', "node__field_release_date.field_release_date_value > 1503944085");

is not formatted correctly. What is this group? Do I need it?

Thanks


texts: How to add outer div to Profile2 profile including link set in #prefix

texts:
I would like to add a wrapper div around Profile2 profiles when displayed on the user account page. I can wrap the title and profile fields by modifying user-profile-category.tpl.php in my theme. However, there's an anchor link to each profile added in profile2.module using hook_user_view: '#prefix' => 'type . '">',.

I can't find a template that will allow me to wrap that link along with its accompanying profile. How can I theme those items together?


texts: How to auto-assign a term based on a combination of terms from three other vocabularies?

texts:
This is a very odd scenario, so bear with me:

I'm importing data from a CSV file via the Feeds module to create product reference nodes. There are 3 columns that contain a term (let's call the columns "Code Types"), so naturally, I set up 3 vocabularies for the product reference nodes to use and mapped/imported the Code Type's terms into each. The client had determined long ago that the terms would not make much sense to the customers, so being able to search for products by selecting a combination of terms would not be helpful. To combat this, new user-friendly keywords were added on the client's old site by assigning each a combination of the 3 terms. I'm trying to replicate this for the new site, and it's driving me insane.

I first began by adding the same 3 Code Type vocabularies to a new 4th "Product Keywords" vocabulary (Yes, terms within terms). After no luck with term or entity reference fiddling, EVA, etc., I decided referencing would go smoother if I made the Keywords a content type with the 3 Code Type term reference fields instead of its own vocabulary. I'm still open to either option, though.

What has to happen is that a product reference node is automatically assigned the Keyword term that exactly matches its 3 Code Type term reference fields, and not all Code Type term reference fields have to have a value. Here are some examples:

Product #42 has:
CodeType1 = "Red"
CodeType2 = "Wheel"
CodeType3 = "Hot Dog"

Product #216 has:
CodeType1 = [empty]
CodeType2 = [empty]
CodeType3 = "Hot Dog"

Keyword "Sloth" has:
CodeType1 = "Red"
CodeType2 = "Wheel"
CodeType3 = "Hot Dog"

Keyword "Muffin" has:
CodeType1 = [empty]
CodeType2 = [empty]
CodeType3 = "Hot Dog"

Product #42 needs to have the keyword "Sloth" automatically assigned to it.

Product #216 needs to have the keyword "Muffin" automatically assigned to it.

Sorry for the longwindedness. It's urgent, and I'm edging toward panic mode. Any ideas? Please?


texts:
I have scoured this site and tried to find examples that I could use and all seem to show the same thing, the code I am writing fits to the right pattern and yet its just not saving!

When submitted the content is created but only the title is saved all the rest is left blank, this is extremely frustrating as I have tried many combinations to try and sort this out PLEASE! any help or pointers are GREATLY appreciated:

           global $user;
    $node = new stdClass();
    $node->type = 'client_account';
    $node->title = $form_state['values']['groupName'];
    $node->uid = $user->uid;
    $node->name = $user->name;
    $node->comment = 0;
    $node->promote = 0;
    $node->language = LANGUAGE_UNDEFINED;
    $node->is_new = True;
    $node->path = array('alias' => 'accounts/' . $form_state['values']['groupName']); // Setting a node path
    node_object_prepare($node); // Set some default values.

    $node->group_group[$node->language][0]['value'] = 1; //this is a checkbox value on or off
    /*
     * The rest of the fileds in the content type are actually text fields
     */
    $node->field_company_contact[$node->language][0]['value'] = $form_state['values']['contactName'];
    $node->field_client_email[$node->language][0]['value'] = $form_state['values']['clientEmail'];
    //not implimented yet but requires a default value
    $node->body[$node->language][0]['value'] = 'set body with page values';
    //not implimented yet but requires a default value
    $node->field_company_logo[$node->language][0]['value'] = "/images/logo.png";
    $node->field_website[$node->language][0]['value'] = $form_state['values']['website'];
    $node->field_address_line1[$node->language][0]['value'] = $form_state['values']['addressLine1'];
    $node->field_address_line_2[$node->language][0]['value'] = $form_state['values']['addressLine2'];
    $node->field_address_line_2[$node->language][0]['value'] = $form_state['values']['addressLine3'];
    $node->field_region[$node->language][0]['value'] = $form_state['values']['county'];
    $node->field_post_code[$node->language][0]['value'] = $form_state['values']['postCode'];
    //Organic groups fields
    $node->og_description = 'A group managed by ' . $user->name;
    $node->og_register = 0;
    $node->og_directory = 1;
    $node->og_private = 1;
    $node->og_selective = 3;
    //create the node
    /*
     * drupal_printd($var, $title, $die=false)
     * is a fucntion I added for on the fly debugging
     */
    drupal_printd($node, "original_node");
    $node = node_submit($node);
    drupal_printd($node, "node save");
    $node = node_save($node);
    drupal_printd($node, "result");
    drupal_goto("accounts");

I hope someone can see why it is not saving as it just IS NOT!!


texts: How to Automatically Manage a LARGE Number of Views Pages Under ONE?

texts:
I am developing a website for a school's Alumni Association that has been around since the 1800s. Every student has a Grad Class specified in the database:

e.g. /students/1947/John_Doe (indicates graduated in 1947; all of this is ready to go).

But now I want to create a page for every year (1890, 1891, ... 1970, 1971, etc.) and have each listed on that page:

e.g. /students/1947 (would list all students who graduated in 1947)

Using Contextual Filters, this is easy!! But the problem is that creating each individual page for each individual year would be extremely cumbersome. Do each of these pages needed to be created manually (with an identical Contextual Filter) or is there a way to automatically manage all of these graduation classes under a single view? If so, how would those pages be created?


texts: How to keep password form populated ever if the validation fails on registration

texts:
On the registration page when the validations for profile fields fail, the page is refreshed with error messages. The problem is that then the password form is cleared even if the user has already entered an acceptable password.
Is there any way to keep the password populated even if the page is refreshed after the validation fails?


texts:
I would like to have webform submission username using views.
Add fields > webform submissions: user
The result is uid (user id number)

How can I have username login name instead of uid ?


texts: New VBO bulk operation button not get translated

texts:
VBO button not translated issue.

I have created a new VBO bulk operation using rules component.

This is the button:

In Rules I have written the translation for this rule, in the translate tab of the rule.

But the button in the view doesn't display translated.
:(

Too I tried to override a label in the view for this button, and translate this label with the translate view option, translating this field.

But the button doesn't translate too.

How could I translate my button?


texts:
I want to create a drupal site to record student's grades. Since every student will have a class, I want to make an assignment page that contains all the students' names(belonging to a class) so that I can record their individual grades. I do not want to edit individual nodes form by form.
However, since each student's grade is considered a node, I can only list the nodes in a view, which is not editable(unless I use the alpha release of Editable module).
This can be done easily in Filemaker but I do not know how to do it in Drupal. I wish to know what is the idea to achieve the goal? I think doing in Views is not ideal. What will you do to achieve this goal?


texts: Rewrite results output creates 2 links for one for one rewritten custom text field

texts:
I am using replacement patterns to rewrite the results of my content title field with the manufacturers name in front of the title. I am using the following custom text within the title field to accomplish this:

{{ field_tool_manufacturer }}
{{ title }}

I am then outputting this field as a custom link, with the path Node/{{ nid }}

Both the manufacturer and title fields render linked to the node correctly, but the problem is that they should be a single rewritten text link, but it's being output as 2 separate links. One link for the manufacturer, and a separate one for the title. This of course isn't optimal for UX as it communicates 2 separate links especially with css hover styling, etc.

The results are the same when removing the
 line break. The manufacturer field is excluded from the display, and it is not set to be output as a link in the original field. I have tried multiple style settings with no better luck.

I did this with very little trouble in Drupal 7, so I am wondering if this is a bug that I should create an issue for, or if there is a structural change that is causing the 2 links. I'm new to Drupal 8, so I might be missing something simple. Any help would be appreciated, and let me know if I left out any useful info.

Thanks!


texts:
Drupal 8 has term method loadproperties which works for custom fields; however, how can I use it (or can I use it) to load by substrings. For example if I have a field: field_full_name and I want to load all terms that start with a string "David*" is this possible ... if not how?

Thanks ~


texts: How do I add a JavaScript file to a form?

texts:
I'm trying to add a JavaScript file to a form that I have in a modal.  Although I followed the information found here, here, and here, the file doesn't appear in the Network tab of the inspector and nothing is logged to the browser console when the modal is launched.

The form modal is triggered in
themes/custom/my_theme/templates/controllers/my-controller-theme.html.twig.

Click here to add

The library is defined in my custom theme in themes/custom/my_theme/my_theme.libraries.yml.

my_modals:
  version: 1.x
  js:
    js/my_modals.js: {}
  dependencies:
    - core/jquery

The JavaScript file is themes/custom/my_theme/js/my_modals.js.

(function ($) {
    Drupal.behaviors.my_modals = {
        attach: function (context, settings) {
            console.log('test');
        }
    };
}(jQuery));

The form itself is defined in my custom profile in
profiles/my_profile/src/Form/MyModalAddForm.php.

public function buildForm(array $form, FormStateInterface $form_state) {
  // ...
  $form['#attached']['library'][] = 'my_theme/my_modals';
}


texts: How to create multiple blocks for blog teasers from a single view automatically

texts:
I have created a site whose home page is built in a way that it will display 4 latest blog posts in separate blocks all the time.

I have created a view and successfully created a single block displaying one latest blog post, but I am not sure what to do to get the other 3 blocks generated automatically. Any idea?


texts: Drupal6 reference URL date in views filter?

texts:
I apologize if this is already explained somewhere, I haven't found it.

I have a view in drupal6 based on the date browser example.  I want to show all items having a date greater or equal than the date from the path:

for example, #somesite#.com/events/2012-08-01

with arguments it shows events that are equal to the date in the
path; can it show greater or equal?
with filters it can show greater or equal to a hard-coded date,
but can it reference the date from the path somehow?

Is there some other module or best way to do this?

Update: perhaps this is the answer Date argument as view filter


texts: How to avoid max execution timeout when importing a lot of nodes programmatically?

texts:
I am creating a content synchronisation module. I have a UI that allows a user to import nodes from a remote site.  They enter the site url and web service endpoint, along with some other configuration options, and the program will go and fetch the nodes and import them into the database using node_save.

I received a max timeout error while importing 357 nodes:

Fatal error: Maximum execution time of 30 seconds exceeded in D:\xampp\htdocs\drupal-7.15\modules\pull_content\pull_content.module on line 1188

So, I increased the max execution time to 360 but after 360s it timed out and I got the same error.  I know that the processing hasn't frozen because I can see the nodes going into the node table at a rate of about 3 or 4 every 10s.

I don't want to keep endlessly increasing the timeout as there is the possibility that I may have to import 1000 nodes or more at one time.

Is there any way to avoid this error message other than increasing the max execution time? Maybe by running things in a batch?  Or should I just make the max execution time really large?


texts: How to allow users to edit a specific field of content?

texts:
I have a taxonomy list connected with a content type. I want to give all authenticated users to access the content edit page but only see and access the taxonomy field section so users can participate in making the site more organized and accurate.

Is there a way to only show 1 field to users and allow them to edit just that one field?
If so, how do i show a link on the content page to the edit page? (example: "Click here to edit/add tags"  - This link would then go to the /node/2343/edit link)

My idea comes from many video sharing sites where people can add/edit "categories" or "tags" if the user has permission to do so. These sites usually have a little "+" symbol next to the categories which then opens the category check list for that piece of content for editing.


texts: Does a sub-theme needs the main theme enable?

texts:
Just to clarified a doubt.
But when creating a sub-theme, is it necessary to have the main theme enable ?

Thanks


texts: Which modules should I use to create a community based site?

texts:
I am a grey-haired professional programmer, quiet conversant in PHP, MySql, HTL, CSS which means I can tweak things or code plugins if need be, but I’d like something off the shelf as far as possible.

I am trying to create a social site for ex-pats to help them adjust to their new country. Preparing to get there, legal/visa issues, employment opportunities, accommodation, shopping, plus social stuff.

The demographic is mainly girls in their 20s, so a social angle is important. Integration of FaceBook, Flikr & the like might be nice. What I am thinking of is

main content provided by me and a few moderators
a Wiki to which everyone can contribute
forums for discussions
small ads/freebie
user registration (which may limit access to certain parts of the site)
groups of friends, with shared .. stuff (photos, discussion rooms, etc)
per user blog
per user photo album
mailing lists

As I said, I was originally set on Drupal, which also has some pre-configured distros, but I didn’t find one yet that really matches my needs.

Do you have any suggestions?


texts:
I need to encapsulate in Drupal 7 some fields intro a div and other fields in another div. How can I do that?

Thanks.


texts: How can I copy a body field from one node to another node?

texts:
I'm trying to write a small module that copies the body content from one node to another node. The module does almost what it should and everything arrives so far. However, I have to open the node to be copied once, then save it and then open it again. Then it has taken over everything correctly. But I would like to have the field already copied when I open the node. Since this is my beginnings in module development, I would of course appreciate any tips. I am also sure that this can be done more elegantly.
/**
 * Implements hook_form_alter().
 */
function copy_fields_from_model_contract_form_alter(&$form, FormStateInterface $form_state, $form_id) {

  $nid = 6766;
  $node_storage = \Drupal::entityTypeManager()->getStorage('node');
  $node = $node_storage->load($nid);
  if ($nid == '6766') {
    $getcontract = $node->field_vertragsinhalt->value;
  }

  $nid = 6716;
  $node_storage = \Drupal::entityTypeManager()->getStorage('node');
  $node = $node_storage->load($nid);
  if ($nid == '6716') {
    if ($form_id == 'node_buch_anlegen_edit_form') {
      $node->field_vertragsinhalt->value = $getcontract;
      $node->body->format = 'full_html';
      $node->save();
      dpm("Testsetest");
    }
  }
}


texts:
Can we implement multiple attribute selection sets such as color, size and
quantity multiple times for a single product.

Suppose i have a product display that renders 4 products with colors red and
blue, sizes XL and L.

So in this case, i can add 4 different selection sets. red-XL-quantity,
red-L-quantity, blue-XL-quantity and blue-L-quantity.

Pls check the image for clarification.

I implemented commerce extras with views but it dsnt match my requirement.

I need a link to add multiple sets if necessary.

Thanks :)


texts: Is it possible to replace the original RSS content?

texts:
Is it possible to replace the original RSS generated for the front page by custom content?

I know how to create custom RSS channels using views, but not how to replace the original RSS.


texts: How to connect to online database with local database in Drupal 8 site

texts:
EDITED

How to connect then fetch data from online database to drupal 8 on localhost. Both of them using postgre as main database. I have followed this tutorial and change settings.php's external host with ip from my online database. I try to fetch data with my module, refer to this but still not work, my module look like this:

<?php
namespace Drupal\example\Controller;

class ExampleController {

  public function example() {
\Drupal\Core\Database\Database::setActiveConnection('external');

    // Get a connection going
    $db = \Drupal\Core\Database\Database::getConnection();

print_r($db->databaseType);
$query = $db->select('users', 'u')
    ->fields('u', ['name', 'email']);
$result = $query->execute()->fetchAll();

print_r($result);

\Drupal\Core\Database\Database::setActiveConnection();
  }
}

I was edited this code, looks more simple, and now showing result

  pgsql
  The website encountered an unexpected error. Please try again later.

this result only showing result from print_r($db->databaseType); but i still confuse, is this come from external database? Thank's for some help of this case.


texts: Add a "class selection" field to content item via CCK?

texts:
I have a single content type (webform) that I want to display in two or three different styles on my site. For instance, I may want to have some of the webform's CCK fields floated to the right on one webform page, and have them floated to the left on another. There will be many unique webform content items on the site, so individual CSS per-page styling would not work well, and I am looking for a point-and-click solution.

I was hoping that there would be a way for me to add a CCK field (or something similar) to the Webform content item that would allow me (or another admin user) to simply choose "style 1", "style 2", or "style 3" from a drop-down menu, and that style would be added to that Webform's page  or div classes, allowing that form to be stylized according to one of three pre-created style sets.

Is this possible with an existing module? Any other ways in which I can go about accomplishing this?

Thanks!


texts: Variable not available in alternative template

texts:
I'd like to override the field--image.html.twig template from my base theme in my sub-theme. As I want to override it only for a specific field for a specific node type, I've created the template field--node--field-pictures--slideshow.html.twig.

The rare thing now is, that within the field--image.html.twig the variable item.caption.title (item is the iterator of items) is available, while in my alternative it is not (always NULL). Why is that so?


texts:
I have a local site but drush doesn't seem to be functioning correctly:

$drush status=

PHP executable         :  /usr/local/bin/php
PHP configuration      :  /usr/local/etc/php/5.6/php.ini
PHP OS                 :  Darwin
Drush script           :  /Users/myuser/vendor/drush/drush/drush.php
Drush version          :  8.1.5
Drush temp directory   :  /tmp
Drush configuration    :
Drush alias files      :  /Users/myuser/.drush/sitename.aliases.drushrc.php

It's not listing anything about the drupal site, so I can't run any drush commands on the local.

Does anyone know how to set this up correctly?


texts:
I have successfully created a field with my module and managed to show it on user registration form. The next step would be validating my field. There are two hooks for this, and I'm confused as to which one to use. One is hook_field_validate and the other is hook_field_attach_validate. I'm also confused as to how to refer to the field. $instance['user']['field_tckn_no']? (This is what dpm(field_info_instances('user') shows me. Also, one thing that confuses me is that hook_field_validate iterates over the fields but all I have is one field. Is it still the one to use?

Regards,
K.


texts: We have many editors that are going to submit documents for appearance on our website. Most documents come in the form of a .doc etc. What would be the best method of importing the text into a content node?


texts:
I can track core taxonomy terms with the custom variable [term] in the Google Analytics module, but I can't do the same for cck content taxonomy, even if I choose [cck-field-name-terms] or [cck-field-name-term], only the variable name is display by GA and I can't see details.

I'm using Drupal 6.


texts: Exposed filter shs (simple hierarchical select) in a custom template

texts: I don't see anywhere how to print this exposed filter in a custom template.


texts:
I enabled organic group example module. When I looked at my groups, none of the content belong to the group was displaying. It seem to be a filter error of some sort, but this is all straight out of example and it's not working.

Has anyone experienced this problem?


texts:
So I am trying to build a sortable paginated table.  So far I have failed at both.

For some reason, in this state it will only return 2 lines on page one, 10 on page two, and 2 again on page three.

Here is my code:

function vendor_open_orders() {
  global $user;
  $header = array(
    array('data' => t('Order ID')),
    array('data' => t('Customer')),
    // other header stuff
  );
  $query = db_select('uc_orders', 'o')
        ->fields('o', array('order_id'))
        ->distinct()
        ->condition('n.uid', $user->uid)
        ->condition('o.order_status', array('pending', 'payment_received'))
        ->orderBy('o.order_id', 'ASC')
        ->extend('PagerDefault');
  $query->join('uc_order_products', 'op', 'o.order_id = op.order_id');
  $query->join('node', 'n', 'op.nid = n.nid');
  //$query = $query->extend('TableSort');
  //$query->limit(5);
  $exquery = $query->execute();
  foreach ($exquery as $result) {
    //$rows, etc
  }

...

  $build['pager_table'] = array(
    '#theme' => 'table',
    '#header' => $header,
    '#rows' => $rows,
    '#empty' => t('There are no open orders to display.'),
  );
  $build['pager_pager'] = array('#theme' => 'pager');
  return $build;
}


texts: ApcClassLoader.php completely breaks site on module update

texts:
I am working on a site that has installs on 3 different environments: a local development copy on a Windows machine, a staging copy on a Linux machine, and a production copy on a Linux machine. All of these environments are being upgraded to the latest version of Drupal 8 and updating all modules. This is being done manually on all environments and not from pulling updated code from each other.

Updating the search_api module works perfectly fine on the Linux environments, but has taken the site completely down on the Windows development environment. This is the error message I get no matter what page I try to load:

Fatal error: require(): Failed opening required 'C:\[installpath]/modules/search_api/src\ParamConverter\SearchApiConverter.php' (include_path='.;C:\[apachepath]\common\pear') in C:\[installpath]\vendor\symfony\class-loader\ApcClassLoader.php on line 110

There are mismatched directory separators in the requested path, and the path is also incorrect, it should be

C:\[installpath]\modules\search_api\src\ProxyClass\ParamConverter\SearchApiConverter.php.

Line 110 of the file in question is just require $file;. I have absolutely no idea how to troubleshoot this.

Other related plugins I have installed are search_api_page and search_api_sorts, but these seem to be unrelated to the issue.


texts: How can I create a View that shows nodes without a relation?

texts:
On my site, all the nodes of content type ABC are supposed to have a relation (from the Relation module) to a user.

However, although the relations are usually created in Rules, somehow this didn't happen for some nodes, and to make it worse, it happened randomly (non-sequentially).

So, I would like to make a view that shows the nodes which do not have any relation-- but I can't figure out how to configure the view to do that.

If I add a Relationship of Has relation Node -> User, I can get all the nodes that DO have a relation, but how do I get all the nodes that DO NOT have a relation?


texts:
I am using  Drupal 7.34, and I am facing an AJAX error trying to use autocomplete fields in my backend (e.g. file field sources, product reference).

After searching for solutions, I found similar problems and mashed up some suggestions by  disabling:

Firebug in Firefox
jQuery Update
Devel
JavaScript compression

I also updated all modules.

Nothing helped.

I always get a popup containing this error  message:

  An AJAX HTTP error occurred. HTTP Result Code: 200 Debugging information follows.
  Path: http://my-ajax-nightmare.com/shop/inline_entity_form/autocomplete/node/field_produkt/bundle
  StatusText: OK

The page is being rendered as it should.

How can I fix the error message?


texts: How to show a menu item for anonymous users only?

texts:
I want to show a "Join Now" tab on the main menu for anonymous users only.

In the past I used Menu per Role module which does exactly that.

Since it's only one tab I would rather use 5 or 10 lines of code. Which hook should I use and what are the functions to check the current user role and add a menu item (or hide it for logged in users)?


texts: load a node content into a lightbox2 (without headers and footer and other blocks)

texts:
is it possible to load a node (from an id) into a lightbox 2 without having to load all the additional blocks ? just what the node has to display

I want to make some popups on some links to allow some nodes to be shown inside..
no submission will be made in this case (comments are disabled)

another cool thing will be including webforms in a lightbox..
Again no headers..but I believe that that's more complicated because it's form submission... so ajax in required


texts: Why doesn't the overlay background show?

texts:
I created a fancybox gallery as block using the Views module and inserted that block into the node using the Insert Block module. Everything works fine, but the overlay background doesn't show.

How do I fix this?

Edit: The problem has been resolved: The 'Overlay helper' was disabled.


texts: Adding class to image-link in render array

texts:
In the render array of an image with link, i tried to add the class 'colorbox-load' to the link, i.e. the <a> tag of the link, but i can't get the adding of the class to work:

$node = node_load(52);
$my_image = field_view_value('node', $node, 'field_image', $my_image[0], array(
          'type' => 'image',
          'settings' => array(
          'image_style' => 'thumbnail',
          'image_link' => 'content',
          ),
        ));

$my_image['#path']['path'] = 'http://www.example.com';
$my_image['#attributes']['class'][] = 'colorbox-load';

What am i doing wrong?


texts: Display region's blocks into user-profile.tpl.php

texts:
I created a view listing content type called stories. Then I created a block with this view.

In mytheme.info file I have this code :

regions[header] = Header
regions[story] = Story
regions[content] = Content

So I put the view into the Story region

I want to display the region into user-profile.tpl.php so I add this code :

<?php print render($page['story']); ?>

If everything work, it should display all the stories via the view.

I don't know why it does not work.

Thanks for your help !


texts: views exposed filters. get access to user

texts:
I have a views "simply views" with many nodes. I need to get access to user, if node has link to this user.
For example I have node "custom access" and field "field_link_user" with value "James" (is the link to drupal user James). And when James go to page "simply views" it see only 1 node "custom access".
I'm know, it's doing with expsoed filters in views, but how..


texts: Can't set default value with hook_field_widget_form_alter()

texts:
function mymodule_field_widget_form_alter(&$element, &$form_state, $context){
if ($context['field']['type'] == 'node_reference' &&
  empty($element['#default_value'])) {
$element['#default_value'] = 51113;
  }
}

the above does not work - I'm simply trying to set a default value through hook_field_widget_form_alter. The hook works - I can alter options and so forth, but not the default value. Any ideas?


texts:
How  to unpublish or disable webform components without code for d7?

I've seen answers to do this programmatically, but I'm looking for a simple "unpublish" or "disable" field from back end GUI, is that possible?


texts: Theme a form element in drupal with template file?

texts:
I wanted to ask you if its possible to do following things:

My form  consists of three elements. 2 Dropdowns and one custom element.

The second dropdown values are getting rendered when I choose a value from the first dropdown (AJAX). The third element (custom) gets rendered when I choose a value from the second dropdown (AJAX).

Now the third element is like a detail view. It contains multiple values (from db).
So the third element shows only detail information from the second dropdown value.

What I want to do is to theme the third element. So you define a template file where you write your html code + the variables (values).

Later you can render this template in the other template where the form is being rendered.

How can I accomplish this?

Maybe a picture helps you:

Thanks for your help!


texts: store session variable and access it through javascript?

texts:
In drupal, how do you store/read session variables? Also, how can i access a stored session variable through javascript?

I'm trying to store whether if a user has closed my modal or not so it doesn't pop up for another day.